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

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

Issue 18563006: More tests updated to optimize code (Part 2). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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 // VMOptions=--optimization-counter-threshold=100 4 // VMOptions=--optimization-counter-threshold=10 --no-use-osr
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 // Test that noSuchMethod dispatching and auto-closurization work correctly. 8 // Test that noSuchMethod dispatching and auto-closurization work correctly.
9 9
10 class A { 10 class A {
11 noSuchMethod(m) { 11 noSuchMethod(m) {
12 return 123; 12 return 123;
13 } 13 }
14 bar(x) => x + 1; 14 bar(x) => x + 1;
(...skipping 25 matching lines...) Expand all
40 Expect.equals(namedArgs[k], m.namedArguments[new Symbol(k)]); 40 Expect.equals(namedArgs[k], m.namedArguments[new Symbol(k)]);
41 } 41 }
42 return 123; 42 return 123;
43 } 43 }
44 List posArgs; 44 List posArgs;
45 Map namedArgs; 45 Map namedArgs;
46 } 46 }
47 47
48 main() { 48 main() {
49 var a = new A(); 49 var a = new A();
50 for (var i = 0; i < 100; ++i) Expect.equals(123, a.foo()); 50 for (var i = 0; i < 20; ++i) Expect.equals(123, a.foo());
51 Expect.throws(() => (a.foo)()); 51 Expect.throws(() => (a.foo)());
52 Expect.equals("123", (a.foo).toString()); 52 Expect.equals("123", (a.foo).toString());
53 53
54 var b = new B(); 54 var b = new B();
55 for (var i = 0; i < 100; ++i) { 55 for (var i = 0; i < 20; ++i) {
56 Expect.equals(2, b.bar(1)); 56 Expect.equals(2, b.bar(1));
57 Expect.equals(123, b.bar()); 57 Expect.equals(123, b.bar());
58 Expect.equals(2, b.bar(1)); 58 Expect.equals(2, b.bar(1));
59 } 59 }
60 60
61 for (var i = 0; i < 100; ++i) { 61 for (var i = 0; i < 20; ++i) {
62 Expect.equals(123, b.bar(1,2,3)); 62 Expect.equals(123, b.bar(1,2,3));
63 Expect.equals(123, b.bar(1,2,foo:3)); 63 Expect.equals(123, b.bar(1,2,foo:3));
64 } 64 }
65 65
66 // Test named and positional arguments. 66 // Test named and positional arguments.
67 var c = new C(1, 2, [100], {"n1":101, "n2":102}); 67 var c = new C(1, 2, [100], {"n1":101, "n2":102});
68 for (var i = 0; i < 100; ++i) { 68 for (var i = 0; i < 20; ++i) {
69 Expect.equals(123, c.bar(100, n1:101, n2:102)); 69 Expect.equals(123, c.bar(100, n1:101, n2:102));
70 Expect.equals(123, c.bar(100, n2:102, n1:101)); 70 Expect.equals(123, c.bar(100, n2:102, n1:101));
71 } 71 }
72 72
73 // Test NoSuchMethodError message. 73 // Test NoSuchMethodError message.
74 for (var i = 0; i < 100; i++) testMessage(); 74 for (var i = 0; i < 20; i++) testMessage();
75 75
76 } 76 }
77 77
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698