| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:test/test.dart'; | 5 import 'package:test/test.dart'; |
| 6 | 6 |
| 7 import 'helper.dart' show check; | 7 import 'helper.dart' show check; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 test('for loop', () { | 10 test('for loop', () { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 main() { | 24 main() { |
| 25 var a = 0; | 25 var a = 0; |
| 26 while (a < 100) { | 26 while (a < 100) { |
| 27 a *= 2; | 27 a *= 2; |
| 28 } | 28 } |
| 29 return a; | 29 return a; |
| 30 }'''; | 30 }'''; |
| 31 return check(code); | 31 return check(code); |
| 32 }); | 32 }); |
| 33 | 33 |
| 34 test('do-while loop', () { |
| 35 String code = ''' |
| 36 main() { |
| 37 var a = 0; |
| 38 do { |
| 39 a *= 2; |
| 40 } while (a < 100); |
| 41 return a; |
| 42 }'''; |
| 43 return check(code); |
| 44 }); |
| 45 |
| 34 test('for-in loop', () { | 46 test('for-in loop', () { |
| 35 String code = ''' | 47 String code = ''' |
| 36 main() { | 48 main() { |
| 37 var sum = 0; | 49 var sum = 0; |
| 38 for (var a in [1, 2, 3]) { | 50 for (var a in [1, 2, 3]) { |
| 39 sum += a; | 51 sum += a; |
| 40 } | 52 } |
| 41 return sum; | 53 return sum; |
| 42 }'''; | 54 }'''; |
| 43 // TODO(het): Check that the code is alpha-equivalent. That is, | 55 // TODO(het): Check that the code is alpha-equivalent. That is, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 66 main() { | 78 main() { |
| 67 var sum = 0; | 79 var sum = 0; |
| 68 for (a in [1, 2, 3]) { | 80 for (a in [1, 2, 3]) { |
| 69 sum += a; | 81 sum += a; |
| 70 } | 82 } |
| 71 return sum; | 83 return sum; |
| 72 }'''; | 84 }'''; |
| 73 return check(code, disableTypeInference: false); | 85 return check(code, disableTypeInference: false); |
| 74 }); | 86 }); |
| 75 } | 87 } |
| OLD | NEW |