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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // Checks that abstract instance methods are correctly resolved. 7 // Checks that abstract instance methods are correctly resolved.
8 8
9 int get length => throw "error: top-level getter called"; 9 int get length => throw "error: top-level getter called";
10 set height(x) { throw "error: top-level setter called"; } 10 set height(x) {
11 width() { throw "error: top-level function called"; } 11 throw "error: top-level setter called";
12 }
13
14 width() {
15 throw "error: top-level function called";
16 }
12 17
13 abstract class A { 18 abstract class A {
14 int get length; // Abstract instance getter. 19 int get length; // Abstract instance getter.
15 set height(x); // Abstract instance setter. 20 set height(x); // Abstract instance setter.
16 int width(); // Abstract instance method. 21 int width(); // Abstract instance method.
17 22
18 // Must resolve to non-abstract length getter in subclass. 23 // Must resolve to non-abstract length getter in subclass.
19 get useLength => length; 24 get useLength => length;
20 // Must resolve to non-abstract height setter in subclass. 25 // Must resolve to non-abstract height setter in subclass.
21 setHeight(x) => height = x; 26 setHeight(x) => height = x;
22 // Must resolve to non-abstract width() method in subclass. 27 // Must resolve to non-abstract width() method in subclass.
23 useWidth() => width(); 28 useWidth() => width();
24 } 29 }
25 30
26 class A1 extends A { 31 class A1 extends A {
27 int length; // Implies a length getter. 32 int length; // Implies a length getter.
28 int height; // Implies a height setter. 33 int height; // Implies a height setter.
29 int width() => 345; 34 int width() => 345;
30 A1(this.length); 35 A1(this.length);
31 } 36 }
32 37
33 main() { 38 main() {
34 var a = new A1(123); 39 var a = new A1(123);
35 Expect.equals(123, a.useLength); 40 Expect.equals(123, a.useLength);
36 a.setHeight(234); 41 a.setHeight(234);
37 Expect.equals(234, a.height); 42 Expect.equals(234, a.height);
38 Expect.equals(345, a.useWidth()); 43 Expect.equals(345, a.useWidth());
39 print([a.useLength, a.height, a.useWidth()]); 44 print([a.useLength, a.height, a.useWidth()]);
40 } 45 }
41
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698