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

Side by Side Diff: tests/language/argument_definition4_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, 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 test1(bool passed, {a: 42}) {
8 if (passed) {
9 Expect.equals(54, a);
10 Expect.isTrue(?a);
11 } else {
12 Expect.equals(42, a);
13 Expect.isFalse(?a);
14 }
15 Expect.isTrue(?passed);
16 }
17
18 test2() {
19 var closure = (passed, {a: 42}) {
20 if (passed) {
21 Expect.equals(54, a);
22 Expect.isTrue(?a);
23 } else {
24 Expect.equals(42, a);
25 Expect.isFalse(?a);
26 }
27 Expect.isTrue(?passed);
28 };
29 closure(true, a:54);
30 closure(false);
31 }
32
33 class A {
34 test3(bool passed, {a: 42}) {
35 if (passed) {
36 Expect.equals(54, a);
37 Expect.isTrue(?a);
38 } else {
39 Expect.equals(42, a);
40 Expect.isFalse(?a);
41 }
42 Expect.isTrue(?passed);
43 }
44 }
45
46
47 test4(bool passed, {a}) {
48 if (passed) {
49 Expect.equals(54, a);
50 Expect.isTrue(?a);
51 } else {
52 Expect.equals(null, a);
53 Expect.isFalse(?a);
54 }
55 Expect.isTrue(?passed);
56 }
57
58 int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
59
60 main() {
61 test1(true, a:54);
62 test1(false);
63 test2();
64 new A().test3(true, a:54);
65 new A().test3(false);
66
67 var things = [test1, test2, new A().test3];
68
69 var closure = things[inscrutable(0)];
70 closure(true, a:54);
71 closure(false);
72
73 closure = things[inscrutable(1)];
74 closure();
75
76 closure = things[inscrutable(2)];
77 closure(true, a:54);
78 closure(false);
79
80 test4(true, a:54);
81 test4(false);
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698