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

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

Issue 288343014: dart2dart: Test cases for better code coverage in dart_tree rewritings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: SVN rebase Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 var global;
8
9 setGlobal(v) {
10 global = v;
11 }
12
13 check_true_true(x, y, v) {
14 if (x) {
15 if (y) {
16 setGlobal(v);
17 }
18 }
19 }
20
21 check_false_true(x, y, v) {
22 if (x) {
23
24 } else {
25 if (y) {
26 setGlobal(v);
27 }
28 }
29 }
30
31 check_true_false(x, y, v) {
32 if (x) {
33 if (y) {
34
35 } else {
36 setGlobal(v);
37 }
38 }
39 }
40
41 check_false_false(x, y, v) {
42 if (x) {
43
44 } else {
45 if (y) {
46
47 } else {
48 setGlobal(v);
49 }
50 }
51 }
52
53
54 main() {
55 check_true_true(true, true, 4);
56 check_true_true(false, false, 1);
57 check_true_true(false, true, 2);
58 check_true_true(true, false, 3);
59
60 Expect.equals(4, global);
61
62 check_true_false(false, false, 1);
63 check_true_false(false, true, 2);
64 check_true_false(true, false, 3);
65 check_true_false(true, true, 4);
66
67 Expect.equals(3, global);
68
69 check_false_true(false, false, 1);
70 check_false_true(false, true, 2);
71 check_false_true(true, false, 3);
72 check_false_true(true, true, 4);
73
74 Expect.equals(2, global);
75
76 check_false_false(false, false, 1);
77 check_false_false(false, true, 2);
78 check_false_false(true, false, 3);
79 check_false_false(true, true, 4);
80
81 Expect.equals(1, global);
82 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart ('k') | tests/language/if_flatten2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698