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

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

Issue 10911211: Runtime support for the new parameter specification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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) 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 // Dart test program for testing optional named parameters. 4 // Dart test program for testing optional named parameters.
5 5
6 6
7 class OptionalNamedParametersTest { 7 class OptionalNamedParametersTest {
8 8
9 static int F00() { 9 static int F00() {
10 return 0; 10 return 0;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 static void test() { 57 static void test() {
58 OptionalNamedParametersTest np = new OptionalNamedParametersTest(); 58 OptionalNamedParametersTest np = new OptionalNamedParametersTest();
59 Expect.equals(0, F00()); 59 Expect.equals(0, F00());
60 Expect.equals(0, np.f11()); 60 Expect.equals(0, np.f11());
61 Expect.equals(10, F11(10)); 61 Expect.equals(10, F11(10));
62 Expect.equals(10, np.f22(10)); 62 Expect.equals(10, np.f22(10));
63 Expect.equals(20, F10()); 63 Expect.equals(20, F10());
64 Expect.equals(20, np.f21()); 64 Expect.equals(20, np.f21());
65 Expect.equals(20, F10(20)); 65 Expect.equals(20, F10(20)); /// 01: runtime error
66 Expect.equals(20, np.f21(20)); 66 Expect.equals(20, np.f21(20));
67 Expect.equals(20, F10(b:20)); 67 Expect.equals(20, F10(b:20));
68 Expect.equals(20, np.f21(b:20)); 68 Expect.equals(20, np.f21(b:20));
69 Expect.equals(1020, F21(10)); 69 Expect.equals(1020, F21(10));
70 Expect.equals(1020, np.f32(10)); 70 Expect.equals(1020, np.f32(10));
71 Expect.equals(1025, F21(10, 25)); 71 Expect.equals(1025, F21(10, 25)); /// 02: runtime error
72 Expect.equals(1025, np.f32(10, 25)); 72 Expect.equals(1025, np.f32(10, 25));
73 Expect.equals(1025, F21(10, b:25)); 73 Expect.equals(1025, F21(10, b:25));
74 Expect.equals(1025, np.f32(10, b:25)); 74 Expect.equals(1025, np.f32(10, b:25));
75 Expect.equals(102030, F31(10)); 75 Expect.equals(102030, F31(10));
76 Expect.equals(102030, np.f42(10)); 76 Expect.equals(102030, np.f42(10));
77 Expect.equals(102530, F31(10, 25)); 77 Expect.equals(102530, F31(10, 25)); /// 03: runtime error
78 Expect.equals(102530, np.f42(10, 25)); 78 Expect.equals(102530, np.f42(10, 25)); /// 04: runtime error
79 Expect.equals(102530, F31(10, b:25)); 79 Expect.equals(102530, F31(10, b:25));
80 Expect.equals(102530, np.f42(10, b:25)); 80 Expect.equals(102530, np.f42(10, b:25));
81 Expect.equals(102035, F31(10, c:35)); 81 Expect.equals(102035, F31(10, c:35));
82 Expect.equals(102035, np.f42(10, c:35)); 82 Expect.equals(102035, np.f42(10, c:35));
83 Expect.equals(102535, F31(10, b:25, c:35)); 83 Expect.equals(102535, F31(10, b:25, c:35));
84 Expect.equals(102535, np.f42(10, b:25, c:35)); 84 Expect.equals(102535, np.f42(10, b:25, c:35));
85 Expect.equals(102535, F31(10, 25, c:35)); 85 Expect.equals(102535, F31(10, 25, c:35)); /// 05: runtime error
86 Expect.equals(102535, np.f42(10, 25, c:35)); 86 Expect.equals(102535, np.f42(10, 25, c:35)); /// 06: runtime error
87 Expect.equals(102535, F31(10, c:35, b:25)); 87 Expect.equals(102535, F31(10, c:35, b:25));
88 Expect.equals(102535, np.f42(10, c:35, b:25)); 88 Expect.equals(102535, np.f42(10, c:35, b:25));
89 Expect.equals(10200040, F41(10)); 89 Expect.equals(10200040, F41(10));
90 Expect.equals(10200040, np.f52(10)); 90 Expect.equals(10200040, np.f52(10));
91 Expect.equals(10203540, F41(10, c:35)); 91 Expect.equals(10203540, F41(10, c:35));
92 Expect.equals(10203540, np.f52(10, c:35)); 92 Expect.equals(10203540, np.f52(10, c:35));
93 Expect.equals(10250045, F41(10, d:45, b:25)); 93 Expect.equals(10250045, F41(10, d:45, b:25));
94 Expect.equals(10250045, F41(10, 25, d:45)); 94 Expect.equals(10250045, F41(10, 25, d:45)); /// 07: runtime error
95 Expect.equals(10250045, np.f52(10, d:45, b:25)); 95 Expect.equals(10250045, np.f52(10, d:45, b:25));
96 Expect.equals(10253545, F41(10, d:45, c:35, b:25)); 96 Expect.equals(10253545, F41(10, d:45, c:35, b:25));
97 Expect.equals(10253545, np.f52(10, d:45, c:35, b:25)); 97 Expect.equals(10253545, np.f52(10, d:45, c:35, b:25));
98 } 98 }
99 } 99 }
100 100
101 main() { 101 main() {
102 OptionalNamedParametersTest.test(); 102 OptionalNamedParametersTest.test();
103 } 103 }
104 104
105 // TODO(regis): negative tests: [} {] [a:0] {a=0} 105 // TODO(regis): negative tests: [} {] [a:0] {a=0}
OLDNEW
« lib/compiler/implementation/compiler.dart ('K') | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698