| OLD | NEW |
| 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 library boolified_operator_test; | 5 library boolified_operator_test; |
| 6 import "package:expect/expect.dart"; | 6 |
| 7 import 'dart:async'; |
| 8 import 'package:expect/expect.dart'; |
| 9 import 'package:async_helper/async_helper.dart'; |
| 7 import 'compiler_helper.dart'; | 10 import 'compiler_helper.dart'; |
| 8 | 11 |
| 9 const String TEST_EQUAL = r""" | 12 const String TEST_EQUAL = r""" |
| 10 foo(param0, param1) { | 13 foo(param0, param1) { |
| 11 if (param0 == param1) return 0; | 14 if (param0 == param1) return 0; |
| 12 return 1; | 15 return 1; |
| 13 } | 16 } |
| 14 """; | 17 """; |
| 15 | 18 |
| 16 const String TEST_EQUAL_NULL = r""" | 19 const String TEST_EQUAL_NULL = r""" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 43 const String TEST_GREATER_EQUAL = r""" | 46 const String TEST_GREATER_EQUAL = r""" |
| 44 foo(param0, param1) { | 47 foo(param0, param1) { |
| 45 if (param0 >= param1) return 0; | 48 if (param0 >= param1) return 0; |
| 46 return 1; | 49 return 1; |
| 47 } | 50 } |
| 48 """; | 51 """; |
| 49 | 52 |
| 50 main() { | 53 main() { |
| 51 RegExp regexp = new RegExp('=== true'); | 54 RegExp regexp = new RegExp('=== true'); |
| 52 | 55 |
| 53 String generated = compile(TEST_EQUAL, entry: 'foo'); | 56 asyncTest(() => Future.wait([ |
| 54 Expect.isFalse(generated.contains('=== true')); | 57 compile(TEST_EQUAL, entry: 'foo', check: (String generated) { |
| 55 Expect.isTrue(generated.contains('eqB')); | 58 Expect.isFalse(generated.contains('=== true')); |
| 56 | 59 Expect.isTrue(generated.contains('eqB')); |
| 57 generated = compile(TEST_EQUAL_NULL, entry: 'foo'); | 60 }), |
| 58 Expect.isFalse(generated.contains('=== true')); | 61 compile(TEST_EQUAL_NULL, entry: 'foo', check: (String generated) { |
| 59 Expect.isTrue(generated.contains('== null')); | 62 Expect.isFalse(generated.contains('=== true')); |
| 60 | 63 Expect.isTrue(generated.contains('== null')); |
| 61 generated = compile(TEST_LESS, entry: 'foo'); | 64 }), |
| 62 Expect.isFalse(generated.contains('=== true')); | 65 compile(TEST_LESS, entry: 'foo', check: (String generated) { |
| 63 Expect.isTrue(generated.contains('ltB')); | 66 Expect.isFalse(generated.contains('=== true')); |
| 64 | 67 Expect.isTrue(generated.contains('ltB')); |
| 65 generated = compile(TEST_LESS_EQUAL, entry: 'foo'); | 68 }), |
| 66 Expect.isFalse(generated.contains('=== true')); | 69 compile(TEST_LESS_EQUAL, entry: 'foo', check: (String generated) { |
| 67 Expect.isTrue(generated.contains('leB')); | 70 Expect.isFalse(generated.contains('=== true')); |
| 68 | 71 Expect.isTrue(generated.contains('leB')); |
| 69 generated = compile(TEST_GREATER, entry: 'foo'); | 72 }), |
| 70 Expect.isFalse(generated.contains('=== true')); | 73 compile(TEST_GREATER, entry: 'foo', check: (String generated) { |
| 71 Expect.isTrue(generated.contains('gtB')); | 74 Expect.isFalse(generated.contains('=== true')); |
| 72 | 75 Expect.isTrue(generated.contains('gtB')); |
| 73 generated = compile(TEST_GREATER_EQUAL, entry: 'foo'); | 76 }), |
| 74 Expect.isFalse(generated.contains('=== true')); | 77 compile(TEST_GREATER_EQUAL, entry: 'foo', check: (String generated) { |
| 75 Expect.isTrue(generated.contains('geB')); | 78 Expect.isFalse(generated.contains('=== true')); |
| 79 Expect.isTrue(generated.contains('geB')); |
| 80 }), |
| 81 ])); |
| 76 } | 82 } |
| OLD | NEW |