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 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 | 9 |
10 const String INT_PLUS_ZERO = """ | 10 const String INT_PLUS_ZERO = """ |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 main() { | 75 main() { |
76 var plusZero = new RegExp(r"\+ 0"); | 76 var plusZero = new RegExp(r"\+ 0"); |
77 var zeroPlus = new RegExp(r"0 \+"); | 77 var zeroPlus = new RegExp(r"0 \+"); |
78 var timesOne = new RegExp(r"\* 1"); | 78 var timesOne = new RegExp(r"\* 1"); |
79 var oneTimes = new RegExp(r"1 \*"); | 79 var oneTimes = new RegExp(r"1 \*"); |
80 | 80 |
81 asyncTest(() => Future.wait([ | 81 asyncTest(() => Future.wait([ |
82 compileAndDoNotMatch(INT_PLUS_ZERO, 'main', plusZero), | 82 compileAndDoNotMatch(INT_PLUS_ZERO, 'main', plusZero), |
83 compileAndDoNotMatch(ZERO_PLUS_INT, 'main', zeroPlus), | 83 compileAndDoNotMatch(ZERO_PLUS_INT, 'main', zeroPlus), |
84 compileAndMatch(NUM_PLUS_ZERO, 'main', plusZero), | 84 // TODO(johnniwinther): Find out why this doesn't work without [useMock]. |
| 85 compileAndMatch(NUM_PLUS_ZERO, 'main', plusZero, useMock: true), |
85 compileAndMatch(ZERO_PLUS_NUM, 'main', zeroPlus), | 86 compileAndMatch(ZERO_PLUS_NUM, 'main', zeroPlus), |
86 compileAndDoNotMatch(INT_TIMES_ONE, 'main', timesOne), | 87 compileAndDoNotMatch(INT_TIMES_ONE, 'main', timesOne), |
87 compileAndDoNotMatch(ONE_TIMES_INT, 'main', oneTimes), | 88 compileAndDoNotMatch(ONE_TIMES_INT, 'main', oneTimes), |
88 compileAndDoNotMatch(NUM_TIMES_ONE, 'main', timesOne), | 89 compileAndDoNotMatch(NUM_TIMES_ONE, 'main', timesOne), |
89 compileAndDoNotMatch(ONE_TIMES_NUM, 'main', oneTimes), | 90 compileAndDoNotMatch(ONE_TIMES_NUM, 'main', oneTimes), |
90 ])); | 91 ])); |
91 } | 92 } |
OLD | NEW |