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

Side by Side Diff: tests/compiler/dart2js_extra/switch_test.dart

Issue 2765693002: Update all tests (Closed)
Patch Set: Created 3 years, 9 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
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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 switcher(val) { 7 switcher(val) {
8 var x = 0; 8 var x = 0;
9 switch (val) { 9 switch (val) {
10 case 1: 10 case 1:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 return x; 57 return x;
58 } 58 }
59 59
60 60
61 badswitches(val) { 61 badswitches(val) {
62 // Test some badly formed switch bodies. 62 // Test some badly formed switch bodies.
63 // 01 - a label/statement without a following case/default. 63 // 01 - a label/statement without a following case/default.
64 // 02 - a label without a following case/default or statement. 64 // 02 - a label without a following case/default or statement.
65 switch (val) { 65 switch (val) {
66 foo: break; /// 01: compile-time error 66 foo: break; //# 01: compile-time error
67 case 2: /// 02: compile-time error 67 case 2: //# 02: compile-time error
68 foo: /// 02: continued 68 foo: //# 02: continued
69 } 69 }
70 } 70 }
71 71
72 main() { 72 main() {
73 Expect.equals(100, switcher(1)); 73 Expect.equals(100, switcher(1));
74 Expect.equals(200, switcher(2)); 74 Expect.equals(200, switcher(2));
75 Expect.equals(300, switcher(3)); 75 Expect.equals(300, switcher(3));
76 Expect.equals(400, switcher(4)); 76 Expect.equals(400, switcher(4));
77 77
78 Expect.equals(100, switcher2(1)); 78 Expect.equals(100, switcher2(1));
79 Expect.equals(100, switcher2(2)); 79 Expect.equals(100, switcher2(2));
80 Expect.equals(200, switcher2(3)); 80 Expect.equals(200, switcher2(3));
81 Expect.equals(200, switcher2(4)); 81 Expect.equals(200, switcher2(4));
82 Expect.equals(200, switcher2(5)); 82 Expect.equals(200, switcher2(5));
83 83
84 badswitches(42); 84 badswitches(42);
85 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698