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

Side by Side Diff: tests/language_strong/getters_setters2_test.dart

Issue 2765893003: Fix warnings_checker.dart handling of multitests (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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Tests classes with getters and setters that do not have the same type. 7 // Tests classes with getters and setters that do not have the same type.
8 8
9 class A { 9 class A {
10 int a() { return 37;} 10 int a() { return 37;}
(...skipping 11 matching lines...) Expand all
22 // OK, B is assignable to A 22 // OK, B is assignable to A
23 void set field(B arg) { getterField = arg; } 23 void set field(B arg) { getterField = arg; }
24 } 24 }
25 25
26 class T2 { 26 class T2 {
27 A getterField; 27 A getterField;
28 C setterField; 28 C setterField;
29 A get field { return getterField; } 29 A get field { return getterField; }
30 30
31 // Type C is not assignable to A 31 // Type C is not assignable to A
32 void set field(C arg) { setterField = arg; } /// 01: static type warning 32 void set field(C arg) { setterField = arg; } //# 01: static type warning
33 } 33 }
34 34
35 class T3 { 35 class T3 {
36 B getterField; 36 B getterField;
37 B get field { return getterField; } 37 B get field { return getterField; }
38 // OK, A is assignable to B 38 // OK, A is assignable to B
39 void set field(A arg) { getterField = arg; } 39 void set field(A arg) { getterField = arg; }
40 } 40 }
41 41
42 42
43 main() { 43 main() {
44 T1 instance1 = new T1(); 44 T1 instance1 = new T1();
45 T2 instance2 = new T2(); /// 01: continued 45 T2 instance2 = new T2(); //# 01: continued
46 T3 instance3 = new T3(); 46 T3 instance3 = new T3();
47 47
48 instance1.field = new B(); 48 instance1.field = new B();
49 A resultA = instance1.field; 49 A resultA = instance1.field;
50 instance1.field = new A(); /// 03: dynamic type error 50 instance1.field = new A(); //# 03: dynamic type error
51 B resultB = instance1.field; 51 B resultB = instance1.field;
52 52
53 int result; 53 int result;
54 result = instance1.field.a(); 54 result = instance1.field.a();
55 Expect.equals(37, result); 55 Expect.equals(37, result);
56 56
57 // Type 'A' has no method named 'b' 57 // Type 'A' has no method named 'b'
58 instance1.field.b(); /// 02: static type warning 58 instance1.field.b(); //# 02: static type warning
59 59
60 instance3.field = new B(); 60 instance3.field = new B();
61 result = instance3.field.a(); 61 result = instance3.field.a();
62 Expect.equals(37, result); 62 Expect.equals(37, result);
63 result = instance3.field.b(); 63 result = instance3.field.b();
64 Expect.equals(38, result); 64 Expect.equals(38, result);
65 } 65 }
OLDNEW
« no previous file with comments | « tests/language_strong/getter_parameters_test.dart ('k') | tests/language_strong/getters_setters_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698