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

Side by Side Diff: tests/language/rewrite_if_empty_then_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 = 0;
8
9 effect() {
10 global = 1;
11 }
12 baz(b) { return b; }
13
14 foo(b) {
15 if (b) {
16 // do nothing
17 } else {
18 effect();
19 }
20 return baz(b);
21 }
22
23 foo2(b) {
24 if (b) {
25 // do nothing (but implicit return may get inlined up here)
26 } else {
27 effect();
28 }
29 }
30
31 main() {
32 global = 0;
33 Expect.equals(true, foo(true));
34 Expect.equals(0, global);
35
36 global = 0;
37 Expect.equals(false, foo(false));
38 Expect.equals(1, global);
39
40 global = 0;
41 foo2(true);
42 Expect.equals(0, global);
43
44 global = 0;
45 foo2(false);
46 Expect.equals(1, global);
47 }
OLDNEW
« no previous file with comments | « tests/language/rewrite_conditional_test.dart ('k') | tests/language/rewrite_if_return_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698