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

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

Issue 250823006: Translate parts of engine.services project. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to pkg/analysis_services/ Created 6 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 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/GuavaSemanticProcessorTest.java
diff --git a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/GuavaSemanticProcessorTest.java b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/GuavaSemanticProcessorTest.java
index f44513ec424c4af4d27d095cdb3bada56e05682e..44ab2ac83976adb7a3a99e790311e7650bde7d96 100644
--- a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/GuavaSemanticProcessorTest.java
+++ b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/GuavaSemanticProcessorTest.java
@@ -18,6 +18,31 @@ package com.google.dart.java2dart.processor;
*/
public class GuavaSemanticProcessorTest extends SemanticProcessorTest {
+ public void test_ImmutableList() throws Exception {
+ setFileLines(
+ "com/google/common/collect/ImmutableList.java",
+ toString(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package com.google.common.collect;",
+ "import java.util.*;",
+ "public class ImmutableList {",
+ " public static <T> List<T> of() { return null; }",
+ "}"));
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "import java.util.*;",
+ "import com.google.common.collect.ImmutableList;",
+ "public class Test {",
+ " public Object test_of_zero() { return ImmutableList.of(); }",
+ "}");
+ runProcessor();
+ assertFormattedSource(//
+ "class Test {",
+ " Object test_of_zero() => [];",
+ "}");
+ }
+
public void test_ImmutableMap_of_empty() throws Exception {
setFileLines(
"com/google/common/collect/ImmutableMap.java",
@@ -43,6 +68,31 @@ public class GuavaSemanticProcessorTest extends SemanticProcessorTest {
"}");
}
+ public void test_Iterables() throws Exception {
+ setFileLines(
+ "com/google/common/collect/Iterables.java",
+ toString(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package com.google.common.collect;",
+ "import java.util.*;",
+ "public class Iterables {",
+ " public static <T> T getLast(Iterable<T> iterable) { return null; }",
+ "}"));
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "import java.util.*;",
+ "import com.google.common.collect.Iterables;",
+ "public class Test {",
+ " public Object test_getLast(List<String> values) { return Iterables.getLast(values); }",
+ "}");
+ runProcessor();
+ assertFormattedSource(
+ "class Test {",
+ " Object test_getLast(List<String> values) => values.last;",
+ "}");
+ }
+
public void test_Lists() throws Exception {
setFileLines(
"com/google/common/collect/Lists.java",
@@ -141,6 +191,7 @@ public class GuavaSemanticProcessorTest extends SemanticProcessorTest {
"import java.util.Set;",
"public class Sets {",
" public static <T> Set<T> newHashSet() { return null; }",
+ " public static <T> Set<T> newLinkedHashSet() { return null; }",
" public static <T> Set<T> difference(Set<T> s, Set<?> t) { return null; }",
"}"));
translateSingleFile(
@@ -150,12 +201,14 @@ public class GuavaSemanticProcessorTest extends SemanticProcessorTest {
"import com.google.common.collect.Sets;",
"public class Test {",
" public Object test_newHashSet() { return Sets.newHashSet(); }",
+ " public Object test_newLinkedHashSet() { return Sets.newLinkedHashSet(); }",
" public Object test_difference(Set<String> s, Set<String> t) { return Sets.difference(s, t); }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" Object test_newHashSet() => new Set();",
+ " Object test_newLinkedHashSet() => new LinkedHashSet();",
" Object test_difference(Set<String> s, Set<String> t) => s.difference(t);",
"}");
}

Powered by Google App Engine
This is Rietveld 408576698