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.dart"); | 5 #library("boolified_operator_test.dart"); |
6 #import("compiler_helper.dart"); | 6 #import("compiler_helper.dart"); |
7 | 7 |
8 final String TEST_EQUAL = @""" | 8 const String TEST_EQUAL = @""" |
9 foo(param0, param1) { | 9 foo(param0, param1) { |
10 if (param0 == param1) return 0; | 10 if (param0 == param1) return 0; |
11 return 1; | 11 return 1; |
12 } | 12 } |
13 """; | 13 """; |
14 | 14 |
15 final String TEST_EQUAL_NULL = @""" | 15 const String TEST_EQUAL_NULL = @""" |
16 foo(param0) { | 16 foo(param0) { |
17 if (param0 == null) return 0; | 17 if (param0 == null) return 0; |
18 return 1; | 18 return 1; |
19 } | 19 } |
20 """; | 20 """; |
21 | 21 |
22 final String TEST_LESS = @""" | 22 const String TEST_LESS = @""" |
23 foo(param0, param1) { | 23 foo(param0, param1) { |
24 if (param0 < param1) return 0; | 24 if (param0 < param1) return 0; |
25 return 1; | 25 return 1; |
26 } | 26 } |
27 """; | 27 """; |
28 | 28 |
29 final String TEST_LESS_EQUAL = @""" | 29 const String TEST_LESS_EQUAL = @""" |
30 foo(param0, param1) { | 30 foo(param0, param1) { |
31 if (param0 <= param1) return 0; | 31 if (param0 <= param1) return 0; |
32 return 1; | 32 return 1; |
33 } | 33 } |
34 """; | 34 """; |
35 final String TEST_GREATER = @""" | 35 const String TEST_GREATER = @""" |
36 foo(param0, param1) { | 36 foo(param0, param1) { |
37 if (param0 > param1) return 0; | 37 if (param0 > param1) return 0; |
38 return 1; | 38 return 1; |
39 } | 39 } |
40 """; | 40 """; |
41 | 41 |
42 final String TEST_GREATER_EQUAL = @""" | 42 const String TEST_GREATER_EQUAL = @""" |
43 foo(param0, param1) { | 43 foo(param0, param1) { |
44 if (param0 >= param1) return 0; | 44 if (param0 >= param1) return 0; |
45 return 1; | 45 return 1; |
46 } | 46 } |
47 """; | 47 """; |
48 | 48 |
49 main() { | 49 main() { |
50 RegExp regexp = const RegExp('=== true'); | 50 RegExp regexp = const RegExp('=== true'); |
51 | 51 |
52 String generated = compile(TEST_EQUAL, 'foo'); | 52 String generated = compile(TEST_EQUAL, 'foo'); |
(...skipping 13 matching lines...) Expand all Loading... |
66 Expect.isTrue(generated.contains('leB')); | 66 Expect.isTrue(generated.contains('leB')); |
67 | 67 |
68 generated = compile(TEST_GREATER, 'foo'); | 68 generated = compile(TEST_GREATER, 'foo'); |
69 Expect.isFalse(generated.contains('=== true')); | 69 Expect.isFalse(generated.contains('=== true')); |
70 Expect.isTrue(generated.contains('gtB')); | 70 Expect.isTrue(generated.contains('gtB')); |
71 | 71 |
72 generated = compile(TEST_GREATER_EQUAL, 'foo'); | 72 generated = compile(TEST_GREATER_EQUAL, 'foo'); |
73 Expect.isFalse(generated.contains('=== true')); | 73 Expect.isFalse(generated.contains('=== true')); |
74 Expect.isTrue(generated.contains('geB')); | 74 Expect.isTrue(generated.contains('geB')); |
75 } | 75 } |
OLD | NEW |