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

Unified Diff: tests/language/argument_definition_test.dart

Issue 17977002: - Remove arguments definition test from the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/argument_definition6_test.dart ('k') | tests/language/constructor8_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/argument_definition_test.dart
===================================================================
--- tests/language/argument_definition_test.dart (revision 24537)
+++ tests/language/argument_definition_test.dart (working copy)
@@ -1,78 +1,16 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// Dart test program for testing argument definition test.
+// Dart test program for testing that the argument definition test has been
+// removed.
import "package:expect/expect.dart";
-int test(int a, {int b: 2, int c: 3}) {
- int result = 0;
- ?b;
- ?result; /// 01: compile-time error
- if (?a) {
- result += 100;
- }
- if (?b) {
- result += 20;
- }
- if (?c) {
- var b; ?b; /// 02: compile-time error
- result += 3;
- }
- if ((!?a?!?b:!?c) == (?a??b:?c)) {
- result += 200;
- }
- if (!?a?!?b:!?c == ?a??b:?c) {
- result += 400;
- }
- return result;
+int test(a, {b, c}) {
+ if (?b) return b; /// 01: compile-time error
+ return a + b + c;
}
-closure_test(int a, {int b: 2, int c: 3}) {
- var x = 0;
- return () {
- int result = 0;
- ?b;
- ?result; /// 03: compile-time error
- ?x; /// 04: compile-time error
- if (?a) {
- result += 100;
- }
- if (?b) {
- result += 20;
- }
- if (?c) {
- var b; ?b; /// 05: compile-time error
- result += 3;
- }
- // Equivalent to: (!?c) == ?b.
- if ((!?a?!?b:!?c) == (?a??b:?c)) {
- result += 200;
- }
- // Equivalent to: (!?c) ? ?b : ?c.
- if (!?a?!?b:!?c == ?a??b:?c) {
- result += 400;
- }
- return result;
- };
-}
-
-tl_test([a]) => ?a;
-
main() {
- // Use a loop to test optimized version as well.
- for (int i = 0; i < 1000; i++) {
- Expect.equals(100, test(1));
- Expect.equals(720, test(1, b: 2));
- Expect.equals(523, test(1, b: 2, c: 3));
- Expect.equals(703, test(1, c: 3));
-
- Expect.equals(100, closure_test(1)());
- Expect.equals(720, closure_test(1, b: 2)());
- Expect.equals(523, closure_test(1, b: 2, c: 3)());
- Expect.equals(703, closure_test(1, c: 3)());
-
- Expect.equals(true, tl_test(0));
- Expect.equals(false, tl_test());
- }
+ Expect.equals(6, test(1, b: 2, c:3));
}
« no previous file with comments | « tests/language/argument_definition6_test.dart ('k') | tests/language/constructor8_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698