| Index: tests/language/generic_deep_test.dart
|
| diff --git a/tests/language/generic_deep_test.dart b/tests/language/generic_deep_test.dart
|
| index 9b2cad8257f3da2da412a2f63dd057e5f23fd4ae..f907cea4303bf2f47533c281d7a032b39c91657d 100644
|
| --- a/tests/language/generic_deep_test.dart
|
| +++ b/tests/language/generic_deep_test.dart
|
| @@ -15,15 +15,23 @@ abstract class N {
|
| /** Zero element. */
|
| class Z implements N {
|
| Z();
|
| - N add1() { return new S<Z>(this); }
|
| - N sub1() { throw "Error: sub1(0)"; }
|
| + N add1() {
|
| + return new S<Z>(this);
|
| + }
|
| +
|
| + N sub1() {
|
| + throw "Error: sub1(0)";
|
| + }
|
| }
|
|
|
| /** Successor element. */
|
| class S<K> implements N {
|
| N before;
|
| S(this.before);
|
| - N add1() { return new S<S<K>>(this); }
|
| + N add1() {
|
| + return new S<S<K>>(this);
|
| + }
|
| +
|
| N sub1() {
|
| // It would be super cool if this could be "new K()".
|
| return before;
|
| @@ -38,10 +46,8 @@ N NFromInt(int x) {
|
| }
|
|
|
| int IntFromN(N x) {
|
| - if (x is Z)
|
| - return 0;
|
| - if (x is S)
|
| - return IntFromN(x.sub1()) + 1;
|
| + if (x is Z) return 0;
|
| + if (x is S) return IntFromN(x.sub1()) + 1;
|
| throw "Error";
|
| }
|
|
|
| @@ -60,18 +66,18 @@ main() {
|
| Expect.isTrue(NFromInt(10) is S<S<S<S<S<S<S<S<S<S<Z>>>>>>>>>>);
|
|
|
| // Negative tests.
|
| - Expect.isTrue(NFromInt(0) is !S);
|
| - Expect.isTrue(NFromInt(1) is !Z);
|
| - Expect.isTrue(NFromInt(1) is !S<S>);
|
| - Expect.isTrue(NFromInt(2) is !Z);
|
| - Expect.isTrue(NFromInt(2) is !S<Z>);
|
| - Expect.isTrue(NFromInt(2) is !S<S<S>>);
|
| + Expect.isTrue(NFromInt(0) is! S);
|
| + Expect.isTrue(NFromInt(1) is! Z);
|
| + Expect.isTrue(NFromInt(1) is! S<S>);
|
| + Expect.isTrue(NFromInt(2) is! Z);
|
| + Expect.isTrue(NFromInt(2) is! S<Z>);
|
| + Expect.isTrue(NFromInt(2) is! S<S<S>>);
|
|
|
| // Greater-than tests
|
| Expect.isTrue(NFromInt(4) is S<S>); // 4 >= 2
|
| Expect.isTrue(NFromInt(4) is S<S<S>>); // 4 >= 3
|
| Expect.isTrue(NFromInt(4) is S<S<S<S>>>); // 4 >= 4
|
| - Expect.isTrue(NFromInt(4) is !S<S<S<S<S>>>>); // 4 < 5
|
| + Expect.isTrue(NFromInt(4) is! S<S<S<S<S>>>>); // 4 < 5
|
|
|
| Expect.isTrue(IsEven(NFromInt(0)));
|
| Expect.isFalse(IsEven(NFromInt(1)));
|
|
|