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

Unified Diff: editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessorTest.java

Issue 18129004: Simplify constructors translation, improve code style. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessorTest.java
diff --git a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessorTest.java b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessorTest.java
index 40c1aa9da3eb56f110a6573e449c58089cd6ed90..5e3728197fbb16ac88d39777fc079449d687f119 100644
--- a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessorTest.java
+++ b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ConstructorSemanticProcessorTest.java
@@ -18,44 +18,45 @@ package com.google.dart.java2dart.processor;
*/
public class ConstructorSemanticProcessorTest extends SemanticProcessorTest {
- public void test_constructor_with_statements() throws Exception {
+ public void test_empty() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
- "import java.util.Map;",
"public class Test extends Foo {",
- " Test(String boo) {this.boo = boo;}",
+ " Test() {}",
"}");
runProcessor();
assertFormattedSource(//
"class Test extends Foo {",
- " Test(String boo) {",
- " this.boo = boo;",
- " }",
"}");
}
- public void test_empty_constructor() throws Exception {
+ public void test_hasStatements() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
- "import java.util.Map;",
"public class Test extends Foo {",
- " Test() {}",
+ " Test(String p) {",
+ " print(p);",
+ " }",
"}");
runProcessor();
assertFormattedSource(//
"class Test extends Foo {",
+ " Test(String p) {",
+ " print(p);",
+ " }",
"}");
}
- public void test_super_only() throws Exception {
+ public void test_super_default() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
- "import java.util.Map;",
"public class Test extends Foo {",
- " Test() {super();}",
+ " Test() {",
+ " super();",
+ " }",
"}");
runProcessor();
assertFormattedSource(//
@@ -63,18 +64,40 @@ public class ConstructorSemanticProcessorTest extends SemanticProcessorTest {
"}");
}
- public void test_super_with_arguments() throws Exception {
+ public void test_super_withArguments() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
- "import java.util.Map;",
"public class Test extends Foo {",
- " Test(String boo) {super(boo);}",
+ " Test(String boo) {",
+ " super(boo);",
+ " }",
"}");
runProcessor();
assertFormattedSource(//
"class Test extends Foo {",
- " Test(String boo) : super(boo) {",
+ " Test(String boo) : super(boo);",
+ "}");
+ }
+
+ public void test_this_noOtherStatements() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " Test() {",
+ " this(42);",
+ " }",
+ " Test(int p) {",
+ " print(p);",
+ " }",
+ "}");
+// runProcessor();
+ assertFormattedSource(//
+ "class Test {",
+ " Test() : this.con1(42);",
+ " Test.con1(int p) {",
+ " print(p);",
" }",
"}");
}

Powered by Google App Engine
This is Rietveld 408576698