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

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

Issue 189043003: Improved 'has' properties translation. (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 8e885874ff25089b60bf23209f338102d2975d69..acbe1c749e40de7fb7b8f73ed68e87a602531c67 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
@@ -55,6 +55,30 @@ public class PropertySemanticProcessorTest extends SemanticProcessorTest {
"}");
}
+ public void test_field_BAD_has_set() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " private boolean foo;",
+ " public boolean hasFoo() {",
+ " return foo;",
+ " }",
+ " public void setHasFoo(boolean foo) {",
+ " this.foo = foo;",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(//
+ "class Test {",
+ " bool _foo = false;",
+ " bool get hasFoo => _foo;",
+ " void set hasFoo(bool foo) {",
+ " this._foo = foo;",
+ " }",
+ "}");
+ }
+
public void test_field_BAD_noSetter_butCannotBeFinal() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -308,6 +332,46 @@ public class PropertySemanticProcessorTest extends SemanticProcessorTest {
"}");
}
+ public void test_field_OK_has_set() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " private boolean hasFoo;",
+ " public boolean hasFoo() {",
+ " return hasFoo;",
+ " }",
+ " public void setHasFoo(boolean hasFoo) {",
+ " this.hasFoo = hasFoo;",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(//
+ "class Test {",
+ " bool hasFoo = false;",
+ "}");
+ }
+
+ public void test_field_OK_is_setIs() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " private boolean isFoo;",
+ " public boolean isFoo() {",
+ " return isFoo;",
+ " }",
+ " public void setIsFoo(boolean isFoo) {",
+ " this.isFoo = isFoo;",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(//
+ "class Test {",
+ " bool isFoo = false;",
+ "}");
+ }
+
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