Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: tests/language/cyclic_type_test.dart

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Tests self referencing types. 5 // Tests self referencing types.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 class Base<T> { 9 class Base<T> {
10 get t => T; 10 get t => T;
11 } 11 }
12 12
13 // Derived<T> is contractive. 13 // Derived<T> is contractive.
14 class Derived<T> extends Base<Derived<T>> {} /// 00: ok 14 class Derived<T> extends Base<Derived<T>> {} //# 00: ok
15 15
16 // Derived<T> is contractive. 16 // Derived<T> is contractive.
17 class Derived<T> extends Base<Derived<Derived<int>>> {} /// 01: ok 17 class Derived<T> extends Base<Derived<Derived<int>>> {} //# 01: ok
18 18
19 // Derived<T> is non-contractive. 19 // Derived<T> is non-contractive.
20 class Derived<T> extends Base<Derived<Derived<T>>> {} /// 02: ok 20 class Derived<T> extends Base<Derived<Derived<T>>> {} //# 02: ok
21 21
22 // Derived1<U> and Derived2<V> are contractive. 22 // Derived1<U> and Derived2<V> are contractive.
23 class Derived1<U> extends Base<Derived2<U>> {} /// 03: ok 23 class Derived1<U> extends Base<Derived2<U>> {} //# 03: ok
24 class Derived2<V> extends Base<Derived1<V>> {} /// 03: ok 24 class Derived2<V> extends Base<Derived1<V>> {} //# 03: ok
25 25
26 // Derived1<U> and Derived2<V> are non-contractive. 26 // Derived1<U> and Derived2<V> are non-contractive.
27 class Derived1<U> extends Base<Derived2<U>> {} /// 04: ok 27 class Derived1<U> extends Base<Derived2<U>> {} //# 04: ok
28 class Derived2<V> extends Base<Derived1<Derived2<V>>> {} /// 04: ok 28 class Derived2<V> extends Base<Derived1<Derived2<V>>> {} //# 04: ok
29 29
30 main() { 30 main() {
31 // In the tests below we test that we get "int" and "bool" when calling 31 // In the tests below we test that we get "int" and "bool" when calling
32 // toString() on the int and bool type respectively. This is not required 32 // toString() on the int and bool type respectively. This is not required
33 // behavior. However, we want to keep the original names for the most common 33 // behavior. However, we want to keep the original names for the most common
34 // core types so we make sure to handle these specifically in the compiler. 34 // core types so we make sure to handle these specifically in the compiler.
35 35
36 var d; 36 var d;
37 d = new Derived(); /// 00: continued 37 d = new Derived(); //# 00: continued
38 Expect.equals("Derived", d.t.toString()); /// 00: continued 38 Expect.equals("Derived", d.t.toString()); //# 00: continued
39 d = new Derived<bool>(); /// 00: continued 39 d = new Derived<bool>(); //# 00: continued
40 Expect.equals("Derived<bool>", d.t.toString()); /// 00: continued 40 Expect.equals("Derived<bool>", d.t.toString()); //# 00: continued
41 d = new Derived<Derived>(); /// 00: continued 41 d = new Derived<Derived>(); //# 00: continued
42 Expect.equals("Derived<Derived>", d.t.toString()); /// 00: continued 42 Expect.equals("Derived<Derived>", d.t.toString()); //# 00: continued
43 43
44 d = new Derived(); /// 01: continued 44 d = new Derived(); //# 01: continued
45 45
46 Expect.equals("Derived<Derived<int>>", d.t.toString()); /// 01: continued 46 Expect.equals("Derived<Derived<int>>", d.t.toString()); //# 01: continued
47 d = new Derived<bool>(); /// 01: continued 47 d = new Derived<bool>(); //# 01: continued
48 Expect.equals("Derived<Derived<int>>", d.t.toString()); /// 01: continued 48 Expect.equals("Derived<Derived<int>>", d.t.toString()); //# 01: continued
49 d = new Derived<Derived>(); /// 01: continued 49 d = new Derived<Derived>(); //# 01: continued
50 Expect.equals("Derived<Derived<int>>", d.t.toString()); /// 01: continued 50 Expect.equals("Derived<Derived<int>>", d.t.toString()); //# 01: continued
51 51
52 d = new Derived(); /// 02: continued 52 d = new Derived(); //# 02: continued
53 Expect.equals("Derived<Derived>", d.t.toString()); /// 02: continued 53 Expect.equals("Derived<Derived>", d.t.toString()); //# 02: continued
54 d = new Derived<bool>(); /// 02: continued 54 d = new Derived<bool>(); //# 02: continued
55 Expect.equals("Derived<Derived<bool>>", d.t.toString()); /// 02: continued 55 Expect.equals("Derived<Derived<bool>>", d.t.toString()); //# 02: continued
56 d = new Derived<Derived>(); /// 02: continued 56 d = new Derived<Derived>(); //# 02: continued
57 Expect.equals("Derived<Derived<Derived>>", d.t.toString()); /// 02: continued 57 Expect.equals("Derived<Derived<Derived>>", d.t.toString()); //# 02: continued
58 58
59 d = new Derived1(); /// 03: continued 59 d = new Derived1(); //# 03: continued
60 Expect.equals("Derived2", d.t.toString()); /// 03: continued 60 Expect.equals("Derived2", d.t.toString()); //# 03: continued
61 d = new Derived2(); /// 03: continued 61 d = new Derived2(); //# 03: continued
62 Expect.equals("Derived1", d.t.toString()); /// 03: continued 62 Expect.equals("Derived1", d.t.toString()); //# 03: continued
63 d = new Derived2<Derived1<int>>(); /// 03: continued 63 d = new Derived2<Derived1<int>>(); //# 03: continued
64 Expect.equals("Derived1<Derived1<int>>", d.t.toString()); /// 03: continued 64 Expect.equals("Derived1<Derived1<int>>", d.t.toString()); //# 03: continued
65 65
66 d = new Derived1(); /// 04: continued 66 d = new Derived1(); //# 04: continued
67 Expect.equals("Derived2", d.t.toString()); /// 04: continued 67 Expect.equals("Derived2", d.t.toString()); //# 04: continued
68 d = new Derived2(); /// 04: continued 68 d = new Derived2(); //# 04: continued
69 Expect.equals("Derived1<Derived2>", d.t.toString()); /// 04: continued 69 Expect.equals("Derived1<Derived2>", d.t.toString()); //# 04: continued
70 d = new Derived2<Derived1<int>>(); /// 04: continued 70 d = new Derived2<Derived1<int>>(); //# 04: continued
71 Expect.equals("Derived1<Derived2<Derived1<int>>>", d.t.toString()); /// 04: c ontinued 71 Expect.equals("Derived1<Derived2<Derived1<int>>>", d.t.toString()); //# 04: c ontinued
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698