| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Test constant folding on numbers. | 4 // Test constant folding on numbers. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import 'dart:async'; |
| 7 import 'package:async_helper/async_helper.dart'; |
| 7 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 8 | 9 |
| 9 const String SIMPLY_EMPTY = """ | 10 const String SIMPLY_EMPTY = """ |
| 10 int foo(x) => x; | 11 int foo(x) => x; |
| 11 void main() { | 12 void main() { |
| 12 var a = foo(4); | 13 var a = foo(4); |
| 13 var b = 1; | 14 var b = 1; |
| 14 switch (a) { | 15 switch (a) { |
| 15 case 1: | 16 case 1: |
| 16 b += 2; | 17 b += 2; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 113 } |
| 113 print(a+b); | 114 print(a+b); |
| 114 } | 115 } |
| 115 """; | 116 """; |
| 116 | 117 |
| 117 main() { | 118 main() { |
| 118 var def = new RegExp(r"default:"); | 119 var def = new RegExp(r"default:"); |
| 119 var defOrCase3 = new RegExp(r"(default:|case 3):"); | 120 var defOrCase3 = new RegExp(r"(default:|case 3):"); |
| 120 var case3 = new RegExp(r"case 3:"); | 121 var case3 = new RegExp(r"case 3:"); |
| 121 | 122 |
| 122 compileAndDoNotMatch(SIMPLY_EMPTY, 'main', def); | 123 asyncTest(() => Future.wait([ |
| 123 compileAndDoNotMatch(TOTAL, 'main', defOrCase3); | 124 compileAndDoNotMatch(SIMPLY_EMPTY, 'main', def), |
| 124 compileAndDoNotMatch(OPTIMIZED, 'main', def); | 125 compileAndDoNotMatch(TOTAL, 'main', defOrCase3), |
| 125 compileAndMatch(LABEL, 'main', case3); | 126 compileAndDoNotMatch(OPTIMIZED, 'main', def), |
| 126 compileAndMatch(DEFLABEL, 'main', def); | 127 compileAndMatch(LABEL, 'main', case3), |
| 127 compileAndMatch(EMPTYDEFLABEL, 'main', def); | 128 compileAndMatch(DEFLABEL, 'main', def), |
| 129 compileAndMatch(EMPTYDEFLABEL, 'main', def), |
| 130 ])); |
| 128 } | 131 } |
| OLD | NEW |