| Index: tests/lib_strong/mirrors/parameter_test.dart
|
| diff --git a/tests/lib_strong/mirrors/parameter_test.dart b/tests/lib_strong/mirrors/parameter_test.dart
|
| index 41bb01d996364f2b7ade3f97dbb277182ae39cf2..dd60eb594234e3fdbf644d2cdda6926c5a17d62a 100644
|
| --- a/tests/lib_strong/mirrors/parameter_test.dart
|
| +++ b/tests/lib_strong/mirrors/parameter_test.dart
|
| @@ -11,8 +11,7 @@
|
| /** Test of [ParameterMirror]. */
|
| library test.parameter_test;
|
|
|
| -@MirrorsUsed(
|
| - targets: const ['test.parameter_test', 'dart.core.int'], override: '*')
|
| +@MirrorsUsed(targets: const ['test.parameter_test', 'dart.core.int'], override: '*')
|
| import 'dart:mirrors';
|
|
|
| import 'package:expect/expect.dart';
|
| @@ -25,22 +24,20 @@ class B {
|
|
|
| // TODO(6490): Currently only supported by the VM.
|
| B.baz(final int x, int y, final int z);
|
| - B.qux(int x, [int y = 3 + 1]);
|
| + B.qux(int x, [int y= 3 + 1]);
|
| B.quux(int x, {String str: "foo"});
|
| B.corge({int x: 3 * 17, String str: "bar"});
|
|
|
| var _x;
|
| - get x => _x;
|
| - set x(final value) {
|
| - _x = value;
|
| - }
|
| + get x => _x;
|
| + set x(final value) { _x = value; }
|
|
|
| grault([int x]) {}
|
| garply({int y}) {}
|
| waldo(int z) {}
|
| }
|
|
|
| -class C<S extends int, T> {
|
| +class C <S extends int, T> {
|
| // TODO(6490): Currently only supported by the VM.
|
| foo(int a, S b) => b;
|
| bar(S a, T b, num c) {}
|
| @@ -53,95 +50,82 @@ main() {
|
| if (v is MethodMirror && v.isConstructor) constructors[k] = v;
|
| });
|
|
|
| - List<Symbol> constructorKeys = [
|
| - #B,
|
| - #B.bar,
|
| - #B.baz,
|
| - #B.foo,
|
| - #B.quux,
|
| - #B.qux,
|
| - #B.corge
|
| - ];
|
| + List<Symbol> constructorKeys =
|
| + [#B, #B.bar, #B.baz, #B.foo, #B.quux, #B.qux, #B.corge];
|
| Expect.setEquals(constructorKeys, constructors.keys);
|
|
|
| MethodMirror unnamedConstructor = constructors[#B];
|
| expect('Method(s(B) in s(B), constructor)', unnamedConstructor);
|
| expect('[]', unnamedConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - unnamedConstructor.returnType);
|
| + unnamedConstructor.returnType);
|
|
|
| MethodMirror fooConstructor = constructors[#B.foo];
|
| expect('Method(s(B.foo) in s(B), constructor)', fooConstructor);
|
| - expect(
|
| - '[Parameter(s(x) in s(B.foo),'
|
| - ' type = Class(s(int) in s(dart.core), top-level))]',
|
| - fooConstructor.parameters);
|
| + expect('[Parameter(s(x) in s(B.foo),'
|
| + ' type = Class(s(int) in s(dart.core), top-level))]',
|
| + fooConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - fooConstructor.returnType);
|
| + fooConstructor.returnType);
|
|
|
| MethodMirror barConstructor = constructors[#B.bar];
|
| expect('Method(s(B.bar) in s(B), constructor)', barConstructor);
|
| - expect(
|
| - '[Parameter(s(z) in s(B.bar),'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(x) in s(B.bar),'
|
| - ' type = Type(s(dynamic), top-level))]',
|
| - barConstructor.parameters);
|
| + expect('[Parameter(s(z) in s(B.bar),'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(x) in s(B.bar),'
|
| + ' type = Type(s(dynamic), top-level))]',
|
| + barConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - barConstructor.returnType);
|
| + barConstructor.returnType);
|
|
|
| // dart2js stops testing here.
|
| return; // //# 01: ok
|
|
|
| MethodMirror bazConstructor = constructors[#B.baz];
|
| expect('Method(s(B.baz) in s(B), constructor)', bazConstructor);
|
| - expect(
|
| - '[Parameter(s(x) in s(B.baz), final,'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(y) in s(B.baz),'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(z) in s(B.baz), final,'
|
| - ' type = Class(s(int) in s(dart.core), top-level))]',
|
| - bazConstructor.parameters);
|
| + expect('[Parameter(s(x) in s(B.baz), final,'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(y) in s(B.baz),'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(z) in s(B.baz), final,'
|
| + ' type = Class(s(int) in s(dart.core), top-level))]',
|
| + bazConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - bazConstructor.returnType);
|
| + bazConstructor.returnType);
|
|
|
| MethodMirror quxConstructor = constructors[#B.qux];
|
| expect('Method(s(B.qux) in s(B), constructor)', quxConstructor);
|
| - expect(
|
| - '[Parameter(s(x) in s(B.qux),'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(y) in s(B.qux), optional,'
|
| - ' value = Instance(value = 4),'
|
| - ' type = Class(s(int) in s(dart.core), top-level))]',
|
| - quxConstructor.parameters);
|
| + expect('[Parameter(s(x) in s(B.qux),'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(y) in s(B.qux), optional,'
|
| + ' value = Instance(value = 4),'
|
| + ' type = Class(s(int) in s(dart.core), top-level))]',
|
| + quxConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - quxConstructor.returnType);
|
| + quxConstructor.returnType);
|
|
|
| MethodMirror quuxConstructor = constructors[#B.quux];
|
| expect('Method(s(B.quux) in s(B), constructor)', quuxConstructor);
|
| - expect(
|
| - '[Parameter(s(x) in s(B.quux),'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(str) in s(B.quux), optional, named,'
|
| - ' value = Instance(value = foo),'
|
| - ' type = Class(s(String) in s(dart.core), top-level))]',
|
| - quuxConstructor.parameters);
|
| + expect('[Parameter(s(x) in s(B.quux),'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(str) in s(B.quux), optional, named,'
|
| + ' value = Instance(value = foo),'
|
| + ' type = Class(s(String) in s(dart.core), top-level))]',
|
| + quuxConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - quuxConstructor.returnType);
|
| + quuxConstructor.returnType);
|
|
|
| MethodMirror corgeConstructor = constructors[#B.corge];
|
| expect('Method(s(B.corge) in s(B), constructor)', corgeConstructor);
|
| - expect(
|
| - '[Parameter(s(x) in s(B.corge), optional, named,'
|
| - ' value = Instance(value = 51),'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(str) in s(B.corge), optional, named,'
|
| - ' value = Instance(value = bar),'
|
| - ' type = Class(s(String) in s(dart.core), top-level))]',
|
| - corgeConstructor.parameters);
|
| + expect('[Parameter(s(x) in s(B.corge), optional, named,'
|
| + ' value = Instance(value = 51),'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(str) in s(B.corge), optional, named,'
|
| + ' value = Instance(value = bar),'
|
| + ' type = Class(s(String) in s(dart.core), top-level))]',
|
| + corgeConstructor.parameters);
|
| expect('Class(s(B) in s(test.parameter_test), top-level)',
|
| - corgeConstructor.returnType);
|
| + corgeConstructor.returnType);
|
|
|
| MethodMirror xGetter = cm.declarations[#x];
|
| expect('Method(s(x) in s(B), getter)', xGetter);
|
| @@ -149,57 +133,51 @@ main() {
|
|
|
| MethodMirror xSetter = cm.declarations[const Symbol('x=')];
|
| expect('Method(s(x=) in s(B), setter)', xSetter);
|
| - expect(
|
| - '[Parameter(s(value) in s(x=), final,'
|
| - ' type = Type(s(dynamic), top-level))]',
|
| - xSetter.parameters);
|
| + expect('[Parameter(s(value) in s(x=), final,'
|
| + ' type = Type(s(dynamic), top-level))]',
|
| + xSetter.parameters);
|
|
|
| MethodMirror grault = cm.declarations[#grault];
|
| expect('Method(s(grault) in s(B))', grault);
|
| - expect(
|
| - '[Parameter(s(x) in s(grault), optional,'
|
| - ' type = Class(s(int) in s(dart.core), top-level))]',
|
| - grault.parameters);
|
| + expect('[Parameter(s(x) in s(grault), optional,'
|
| + ' type = Class(s(int) in s(dart.core), top-level))]',
|
| + grault.parameters);
|
| expect('Instance(value = <null>)', grault.parameters[0].defaultValue);
|
|
|
| MethodMirror garply = cm.declarations[#garply];
|
| expect('Method(s(garply) in s(B))', garply);
|
| - expect(
|
| - '[Parameter(s(y) in s(garply), optional, named,'
|
| - ' type = Class(s(int) in s(dart.core), top-level))]',
|
| - garply.parameters);
|
| + expect('[Parameter(s(y) in s(garply), optional, named,'
|
| + ' type = Class(s(int) in s(dart.core), top-level))]',
|
| + garply.parameters);
|
| expect('Instance(value = <null>)', garply.parameters[0].defaultValue);
|
|
|
| MethodMirror waldo = cm.declarations[#waldo];
|
| expect('Method(s(waldo) in s(B))', waldo);
|
| - expect(
|
| - '[Parameter(s(z) in s(waldo),'
|
| - ' type = Class(s(int) in s(dart.core), top-level))]',
|
| - waldo.parameters);
|
| + expect('[Parameter(s(z) in s(waldo),'
|
| + ' type = Class(s(int) in s(dart.core), top-level))]',
|
| + waldo.parameters);
|
| expect('<null>', waldo.parameters[0].defaultValue);
|
|
|
| cm = reflectClass(C);
|
|
|
| MethodMirror fooInC = cm.declarations[#foo];
|
| expect('Method(s(foo) in s(C))', fooInC);
|
| - expect(
|
| - '[Parameter(s(a) in s(foo),'
|
| - ' type = Class(s(int) in s(dart.core), top-level)), '
|
| - 'Parameter(s(b) in s(foo),'
|
| - ' type = TypeVariable(s(S) in s(C),'
|
| - ' upperBound = Class(s(int) in s(dart.core), top-level)))]',
|
| - fooInC.parameters);
|
| + expect('[Parameter(s(a) in s(foo),'
|
| + ' type = Class(s(int) in s(dart.core), top-level)), '
|
| + 'Parameter(s(b) in s(foo),'
|
| + ' type = TypeVariable(s(S) in s(C),'
|
| + ' upperBound = Class(s(int) in s(dart.core), top-level)))]',
|
| + fooInC.parameters);
|
|
|
| MethodMirror barInC = cm.declarations[#bar];
|
| expect('Method(s(bar) in s(C))', barInC);
|
| - expect(
|
| - '[Parameter(s(a) in s(bar),'
|
| - ' type = TypeVariable(s(S) in s(C),'
|
| - ' upperBound = Class(s(int) in s(dart.core), top-level))), '
|
| - 'Parameter(s(b) in s(bar),'
|
| - ' type = TypeVariable(s(T) in s(C),'
|
| - ' upperBound = Class(s(Object) in s(dart.core), top-level))), '
|
| - 'Parameter(s(c) in s(bar),'
|
| - ' type = Class(s(num) in s(dart.core), top-level))]',
|
| - barInC.parameters);
|
| + expect('[Parameter(s(a) in s(bar),'
|
| + ' type = TypeVariable(s(S) in s(C),'
|
| + ' upperBound = Class(s(int) in s(dart.core), top-level))), '
|
| + 'Parameter(s(b) in s(bar),'
|
| + ' type = TypeVariable(s(T) in s(C),'
|
| + ' upperBound = Class(s(Object) in s(dart.core), top-level))), '
|
| + 'Parameter(s(c) in s(bar),'
|
| + ' type = Class(s(num) in s(dart.core), top-level))]',
|
| + barInC.parameters);
|
| }
|
|
|