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

Side by Side Diff: tests/language_strong/super_call4_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) 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 "dart:mirrors" show reflect; 5 import "dart:mirrors" show reflect;
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 // Checks that noSuchMethod is resolved in the super class and not in the 8 // Checks that noSuchMethod is resolved in the super class and not in the
9 // current class. 9 // current class.
10 10
11 class C { 11 class C {
12 E e = new E(); 12 E e = new E();
13 13
14 bool noSuchMethod(Invocation im) { 14 bool noSuchMethod(Invocation im) {
15 if (im.memberName == const Symbol('foo')) { 15 if (im.memberName == const Symbol('foo')) {
16 return im.positionalArguments.isEmpty && 16 return im.positionalArguments.isEmpty &&
17 im.namedArguments.isEmpty && 17 im.namedArguments.isEmpty &&
18 reflect(e).delegate(im); 18 reflect(e).delegate(im);
19 } 19 }
20 if (im.memberName == const Symbol('bar')) { 20 if (im.memberName == const Symbol('bar')) {
21 return im.positionalArguments.length == 1 && 21 return im.positionalArguments.length == 1 &&
22 im.namedArguments.isEmpty && 22 im.namedArguments.isEmpty &&
23 reflect(e).delegate(im); 23 reflect(e).delegate(im);
24 } 24 }
25 if (im.memberName == const Symbol('baz')) { 25 if (im.memberName == const Symbol('baz')) {
26 return im.positionalArguments.isEmpty && 26 return im.positionalArguments.isEmpty &&
27 im.namedArguments.length == 1 && 27 im.namedArguments.length == 1 &&
28 reflect(e).delegate(im); 28 reflect(e).delegate(im);
29 } 29 }
30 if (im.memberName == const Symbol('boz')) { 30 if (im.memberName == const Symbol('boz')) {
31 return im.positionalArguments.length == 1 && 31 return im.positionalArguments.length == 1 &&
32 im.namedArguments.length == 1 && 32 im.namedArguments.length == 1 &&
33 reflect(e).delegate(im); 33 reflect(e).delegate(im);
34 } 34 }
35 return false; 35 return false;
36 } 36 }
37 } 37 }
38 38
39 class D extends C { 39 class D extends C {
40 bool noSuchMethod(Invocation im) { 40 bool noSuchMethod(Invocation im) {
41 return false; 41 return false;
42 } 42 }
43
43 test1() { 44 test1() {
44 return super.foo(); 45 return super.foo();
45 } 46 }
47
46 test2() { 48 test2() {
47 return super.bar(1); 49 return super.bar(1);
48 } 50 }
51
49 test3() { 52 test3() {
50 return super.baz(b: 2); 53 return super.baz(b: 2);
51 } 54 }
55
52 test4() { 56 test4() {
53 return super.boz(1, c: 2); 57 return super.boz(1, c: 2);
54 } 58 }
55 } 59 }
56 60
57 class E { 61 class E {
58 bool foo() => true; 62 bool foo() => true;
59 bool bar(int a) => a == 1; 63 bool bar(int a) => a == 1;
60 bool baz({int b}) => b == 2; 64 bool baz({int b}) => b == 2;
61 bool boz(int a, {int c}) => a == 1 && c == 2; 65 bool boz(int a, {int c}) => a == 1 && c == 2;
62 } 66 }
63 67
64 main() { 68 main() {
65 var d = new D(); 69 var d = new D();
66 Expect.isTrue(d.test1()); 70 Expect.isTrue(d.test1());
67 Expect.isTrue(d.test2()); 71 Expect.isTrue(d.test2());
68 Expect.isTrue(d.test3()); 72 Expect.isTrue(d.test3());
69 Expect.isTrue(d.test4()); 73 Expect.isTrue(d.test4());
70 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698