Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: frog/tests/leg/src/BoolifiedOperatorTest.dart

Issue 10236007: Revert "Avoid "=== true" inside code by calling a function that does this for us." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/tests/leg/src/ConstantFoldingTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #import("compiler_helper.dart");
6
7 final String TEST_EQUAL = @"""
8 foo(param0, param1) {
9 if (param0 == param1) return 0;
10 return 1;
11 }
12 """;
13
14 final String TEST_EQUAL_NULL = @"""
15 foo(param0) {
16 if (param0 == null) return 0;
17 return 1;
18 }
19 """;
20
21 final String TEST_LESS = @"""
22 foo(param0, param1) {
23 if (param0 < param1) return 0;
24 return 1;
25 }
26 """;
27
28 final String TEST_LESS_EQUAL = @"""
29 foo(param0, param1) {
30 if (param0 <= param1) return 0;
31 return 1;
32 }
33 """;
34 final String TEST_GREATER = @"""
35 foo(param0, param1) {
36 if (param0 > param1) return 0;
37 return 1;
38 }
39 """;
40
41 final String TEST_GREATER_EQUAL = @"""
42 foo(param0, param1) {
43 if (param0 >= param1) return 0;
44 return 1;
45 }
46 """;
47
48 main() {
49 RegExp regexp = const RegExp('=== true');
50
51 String generated = compile(TEST_EQUAL, 'foo');
52 Expect.isFalse(generated.contains('=== true'));
53 Expect.isTrue(generated.contains('eqB'));
54
55 generated = compile(TEST_EQUAL_NULL, 'foo');
56 Expect.isFalse(generated.contains('=== true'));
57 Expect.isTrue(generated.contains('eqNullB'));
58
59 generated = compile(TEST_LESS, 'foo');
60 Expect.isFalse(generated.contains('=== true'));
61 Expect.isTrue(generated.contains('ltB'));
62
63 generated = compile(TEST_LESS_EQUAL, 'foo');
64 Expect.isFalse(generated.contains('=== true'));
65 Expect.isTrue(generated.contains('leB'));
66
67 generated = compile(TEST_GREATER, 'foo');
68 Expect.isFalse(generated.contains('=== true'));
69 Expect.isTrue(generated.contains('gtB'));
70
71 generated = compile(TEST_GREATER_EQUAL, 'foo');
72 Expect.isFalse(generated.contains('=== true'));
73 Expect.isTrue(generated.contains('geB'));
74 }
OLDNEW
« no previous file with comments | « no previous file | frog/tests/leg/src/ConstantFoldingTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698