| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 " return BigInteger.ZERO;", | 27 " return BigInteger.ZERO;", |
| 28 " }", | 28 " }", |
| 29 "}"); | 29 "}"); |
| 30 runProcessor(); | 30 runProcessor(); |
| 31 assertFormattedSource(// | 31 assertFormattedSource(// |
| 32 "class Test {", | 32 "class Test {", |
| 33 " int main() => 0;", | 33 " int main() => 0;", |
| 34 "}"); | 34 "}"); |
| 35 } | 35 } |
| 36 | 36 |
| 37 public void test_Boolean_and() throws Exception { |
| 38 translateSingleFile( |
| 39 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 40 "package test;", |
| 41 "public class Test {", |
| 42 " public boolean testAnd2(boolean a, boolean b) {", |
| 43 " return a & b;", |
| 44 " }", |
| 45 " public boolean testAnd3(boolean a, boolean b, boolean c) {", |
| 46 " return a & b & c;", |
| 47 " }", |
| 48 " public void testAndEq(boolean a, boolean b) {", |
| 49 " a &= b;", |
| 50 " }", |
| 51 "}"); |
| 52 runProcessor(); |
| 53 assertFormattedSource( |
| 54 "class Test {", |
| 55 " bool testAnd2(bool a, bool b) => javaBooleanAnd(a, b);", |
| 56 " bool testAnd3(bool a, bool b, bool c) => javaBooleanAnd(javaBooleanAn
d(a, b), c);", |
| 57 " void testAndEq(bool a, bool b) {", |
| 58 " a = javaBooleanAnd(a, b);", |
| 59 " }", |
| 60 "}"); |
| 61 } |
| 62 |
| 37 public void test_Boolean_or() throws Exception { | 63 public void test_Boolean_or() throws Exception { |
| 38 translateSingleFile( | 64 translateSingleFile( |
| 39 "// filler filler filler filler filler filler filler filler filler fille
r", | 65 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 40 "package test;", | 66 "package test;", |
| 41 "public class Test {", | 67 "public class Test {", |
| 42 " public boolean test(boolean a, boolean b) {", | 68 " public boolean test1(boolean a, boolean b) {", |
| 43 " return a | b;", | 69 " return a | b;", |
| 44 " }", | 70 " }", |
| 45 "}"); | 71 " public void test2(boolean a, boolean b) {", |
| 46 runProcessor(); | |
| 47 assertFormattedSource( | |
| 48 "class Test {", | |
| 49 " bool test(bool a, bool b) => javaBooleanOr(a, b);", | |
| 50 "}"); | |
| 51 } | |
| 52 | |
| 53 public void test_Boolean_orEq() throws Exception { | |
| 54 translateSingleFile( | |
| 55 "// filler filler filler filler filler filler filler filler filler fille
r", | |
| 56 "package test;", | |
| 57 "public class Test {", | |
| 58 " public void test(boolean a, boolean b) {", | |
| 59 " a |= b;", | 72 " a |= b;", |
| 60 " }", | 73 " }", |
| 61 "}"); | 74 "}"); |
| 62 runProcessor(); | 75 runProcessor(); |
| 63 assertFormattedSource( | 76 assertFormattedSource( |
| 64 "class Test {", | 77 "class Test {", |
| 65 " void test(bool a, bool b) {", | 78 " bool test1(bool a, bool b) => javaBooleanOr(a, b);", |
| 79 " void test2(bool a, bool b) {", |
| 66 " a = javaBooleanOr(a, b);", | 80 " a = javaBooleanOr(a, b);", |
| 67 " }", | 81 " }", |
| 68 "}"); | 82 "}"); |
| 69 } | 83 } |
| 70 | 84 |
| 71 public void test_Boolean_TRUE() throws Exception { | 85 public void test_Boolean_TRUE() throws Exception { |
| 72 translateSingleFile( | 86 translateSingleFile( |
| 73 "// filler filler filler filler filler filler filler filler filler fille
r", | 87 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 74 "package test;", | 88 "package test;", |
| 75 "public class Test {", | 89 "public class Test {", |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 " main(Exception e) {", | 1171 " main(Exception e) {", |
| 1158 " print(e);", | 1172 " print(e);", |
| 1159 " }", | 1173 " }", |
| 1160 "}"); | 1174 "}"); |
| 1161 } | 1175 } |
| 1162 | 1176 |
| 1163 private void runProcessor() { | 1177 private void runProcessor() { |
| 1164 new ObjectSemanticProcessor(context).process(unit); | 1178 new ObjectSemanticProcessor(context).process(unit); |
| 1165 } | 1179 } |
| 1166 } | 1180 } |
| OLD | NEW |