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

Unified Diff: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java

Issue 10894008: Issue 4770. Infer type only constant List/Map literals (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
diff --git a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
index e5388c611393728f65e4573b042028a5d6fbe3f1..2dacfb07ab924c25d8f143f3dd8f171b0c8252ac 100644
--- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
@@ -24,6 +24,7 @@ import com.google.dart.compiler.parser.DartParserRunner;
import com.google.dart.compiler.resolver.Element;
import com.google.dart.compiler.type.Type;
import com.google.dart.compiler.type.TypeKind;
+import com.google.dart.compiler.util.apache.StringUtils;
import junit.framework.TestCase;
@@ -433,7 +434,7 @@ public abstract class CompilerTestCase extends TestCase {
assertNotNull(element);
// check type
Type actualType = element.getType();
- assertEquals(element.getName(), expectedType, actualType.toString());
+ assertEquals(element.getName(), expectedType, getTypeSource(actualType));
// should be inferred
if (TypeKind.of(actualType) != TypeKind.DYNAMIC) {
assertTrue("Should be marked as inferred", actualType.isInferred());
@@ -441,6 +442,15 @@ public abstract class CompilerTestCase extends TestCase {
}
/**
+ * @return the source-like {@link String} for the given {@link Type}.
+ */
+ protected static String getTypeSource(Type actualType) {
+ String source = actualType.toString();
+ source = StringUtils.replace(source, "<dynamic>", "Dynamic");
+ return source;
+ }
+
+ /**
* @return the {@link Element} with given name, may be <code>null</code>.
*/
private static Element getNamedElement(DartUnit unit, final String name) {

Powered by Google App Engine
This is Rietveld 408576698