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

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

Issue 11225006: Handle super != and ? (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 argument definition test. 4 // Dart test program for testing argument definition test.
5 5
6 int test(int a, {int b: 2, int c: 3}) { 6 int test(int a, {int b: 2, int c: 3}) {
7 int result = 0; 7 int result = 0;
8 ?b; 8 ?b;
9 ?result; /// 01: compile-time error 9 ?result; /// 01: compile-time error
10 if (?a) { 10 if (?a) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 result += 200; 48 result += 200;
49 } 49 }
50 // Equivalent to: (!?c) ? ?b : ?c. 50 // Equivalent to: (!?c) ? ?b : ?c.
51 if (!?a?!?b:!?c == ?a??b:?c) { 51 if (!?a?!?b:!?c == ?a??b:?c) {
52 result += 400; 52 result += 400;
53 } 53 }
54 return result; 54 return result;
55 }; 55 };
56 } 56 }
57 57
58 tl_test([a]) => ?a;
59
58 main() { 60 main() {
59 // Use a loop to test optimized version as well. 61 // Use a loop to test optimized version as well.
60 for (int i = 0; i < 1000; i++) { 62 for (int i = 0; i < 1000; i++) {
61 Expect.equals(100, test(1)); 63 Expect.equals(100, test(1));
62 Expect.equals(720, test(1, b: 2)); 64 Expect.equals(720, test(1, b: 2));
63 Expect.equals(523, test(1, b: 2, c: 3)); 65 Expect.equals(523, test(1, b: 2, c: 3));
64 Expect.equals(703, test(1, c: 3)); 66 Expect.equals(703, test(1, c: 3));
65 67
66 Expect.equals(100, closure_test(1)()); 68 Expect.equals(100, closure_test(1)());
67 Expect.equals(720, closure_test(1, b: 2)()); 69 Expect.equals(720, closure_test(1, b: 2)());
68 Expect.equals(523, closure_test(1, b: 2, c: 3)()); 70 Expect.equals(523, closure_test(1, b: 2, c: 3)());
69 Expect.equals(703, closure_test(1, c: 3)()); 71 Expect.equals(703, closure_test(1, c: 3)());
72
73 Expect.equals(true, tl_test(0));
74 Expect.equals(false, tl_test());
70 } 75 }
71 } 76 }
OLDNEW
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698