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

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

Issue 214253002: Translate Java enums to Dart constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/PropertySemanticProcessorTest.java
diff --git a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/PropertySemanticProcessorTest.java b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/PropertySemanticProcessorTest.java
index f773df5c46d1796923656bae71b0bb29ed2f4ed3..74f42d945cbf8d4c04abbe23d07e5c3d38646433 100644
--- a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/PropertySemanticProcessorTest.java
+++ b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/PropertySemanticProcessorTest.java
@@ -79,33 +79,6 @@ public class PropertySemanticProcessorTest extends SemanticProcessorTest {
"}");
}
- public void test_field_BAD_noSetter_butCannotBeFinal() throws Exception {
- translateSingleFile(
- "// filler filler filler filler filler filler filler filler filler filler",
- "package test;",
- "public class Test {",
- " private int foo;",
- " public int getFoo() {",
- " return foo;",
- " }",
- " public Test(int foo) {",
- " this.foo = foo;",
- " }",
- " public Test(boolean bar) {",
- " }",
- "}");
- runProcessor();
- assertFormattedSource(
- "class Test {",
- " int _foo = 0;",
- " int get foo => _foo;",
- " Test.con1(int foo) {",
- " this._foo = foo;",
- " }",
- " Test.con2(bool bar);",
- "}");
- }
-
public void test_field_BAD_notSameGetterSetterFields() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -249,7 +222,6 @@ public class PropertySemanticProcessorTest extends SemanticProcessorTest {
"}");
}
- // XXX
public void test_field_OK_getter_hasInitializer() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -310,6 +282,31 @@ public class PropertySemanticProcessorTest extends SemanticProcessorTest {
"}");
}
+ public void test_field_OK_getter_withConstructor2() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " private int foo;",
+ " public Test() {",
+ " this(5);",
+ " }",
+ " public Test(int foo) {",
+ " this.foo = foo;",
+ " }",
+ " public int getFoo() {",
+ " return foo;",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(//
+ "class Test {",
+ " final int foo;",
+ " Test() : this.con1(5);",
+ " Test.con1(this.foo);",
+ "}");
+ }
+
public void test_field_OK_getterSetter() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -394,6 +391,55 @@ public class PropertySemanticProcessorTest extends SemanticProcessorTest {
"}");
}
+ public void test_field_OK_noGetterSetter_constructor() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " private int foo;",
+ " public int getBar() {",
+ " return foo + 1;",
+ " }",
+ " public Test(int foo) {",
+ " this.foo = foo;",
+ " int baz = foo;",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(
+ "class Test {",
+ " final int _foo;",
+ " int get bar => _foo + 1;",
+ " Test(this._foo) {",
+ " int baz = _foo;",
+ " }",
+ "}");
+ }
+
+ public void test_field_OK_noSetter_constructor() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " private int foo;",
+ " public int getFoo() {",
+ " return foo;",
+ " }",
+ " public Test(int foo) {",
+ " this.foo = foo;",
+ " }",
+ " public Test(boolean bar) {",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(
+ "class Test {",
+ " final int foo;",
+ " Test.con1(this.foo);",
+ " Test.con2(bool bar);",
+ "}");
+ }
+
public void test_methodGetWithoutName() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",

Powered by Google App Engine
This is Rietveld 408576698