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

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

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Dart test program testing that NoSuchMethod is properly called. 4 // Dart test program testing that NoSuchMethod is properly called.
5 5
6 class NoSuchMethodTest { 6 class NoSuchMethodTest {
7 7
8 foo([a = 10, b = 20]) { 8 foo([a = 10, b = 20]) {
9 return (10 * a) + b; 9 return (10 * a) + b;
10 } 10 }
11 11
12 noSuchMethod(String name, List args) { 12 noSuchMethod(String name, List args) {
13 Expect.equals("moo", name); 13 Expect.equals("moo", name);
14 Expect.equals(1, args.length); 14 Expect.equals(1, args.length);
15 return foo(args[0]); 15 return foo(args[0]);
16 } 16 }
17 17
18 static testMain() { 18 static testMain() {
19 var obj = new NoSuchMethodTest(); 19 var obj = new NoSuchMethodTest();
20 Expect.equals(1010, obj.moo(b:99)); // obj.NoSuchMethod called here. 20 Expect.equals(1010, obj.moo(b:99)); // obj.NoSuchMethod called here.
21 // After we remove the rest argument and change the signature of 21 // After we remove the rest argument and change the signature of
22 // noSuchMethod to be compatible with named arguments, we can expect the 22 // noSuchMethod to be compatible with named arguments, we can expect the
23 // correct value of 199 instead of 1010. 23 // correct value of 199 instead of 1010.
24 } 24 }
25 } 25 }
26 26
27 main() { 27 main() {
28 NoSuchMethodTest.testMain(); 28 NoSuchMethodTest.testMain();
29 } 29 }
OLDNEW
« no previous file with comments | « tests/language/no_such_method_negative_test.dart ('k') | tests/language/non_const_constructor_without_body_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698