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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/constant/ConstantEvaluatorTest.java

Issue 589043003: Backout constant support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/constant/ConstantEvaluatorTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/constant/ConstantEvaluatorTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/constant/ConstantEvaluatorTest.java
index 8b1ba91ed8516f83ee9afce3549c974988bc265f..e4ff30af2f15f946b25a35d37ccd8b9e3985f8a0 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/constant/ConstantEvaluatorTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/constant/ConstantEvaluatorTest.java
@@ -22,6 +22,7 @@ import com.google.dart.engine.element.LibraryElement;
import com.google.dart.engine.internal.context.AnalysisContextImpl;
import com.google.dart.engine.resolver.ResolverTestCase;
import com.google.dart.engine.source.Source;
+import com.google.dart.engine.type.InterfaceType;
public class ConstantEvaluatorTest extends ResolverTestCase {
public void fail_constructor() throws Exception {
@@ -73,6 +74,10 @@ public class ConstantEvaluatorTest extends ResolverTestCase {
assertEquals(null, value);
}
+ public void fail_plus_string_string() throws Exception {
+ assertValue("ab", "'a' + 'b'");
+ }
+
public void fail_prefixedIdentifier_invalid() throws Exception {
EvaluationResult result = getExpressionValue("?");
assertTrue(result.isValid());
@@ -115,6 +120,14 @@ public class ConstantEvaluatorTest extends ResolverTestCase {
assertEquals(null, value);
}
+ public void fail_stringLength_complex() throws Exception {
+ assertValue(6L, "('qwe' + 'rty').length");
+ }
+
+ public void fail_stringLength_simple() throws Exception {
+ assertValue(6L, "'Dvorak'.length");
+ }
+
public void test_bitAnd_int_int() throws Exception {
assertValue(74 & 42, "74 & 42");
}
@@ -313,10 +326,6 @@ public class ConstantEvaluatorTest extends ResolverTestCase {
assertValue(5L, "2 + 3");
}
- public void test_plus_string_string() throws Exception {
- assertValue("ab", "'a' + 'b'");
- }
-
public void test_remainder_double_double() throws Exception {
assertValue(3.2 % 2.3, "3.2 % 2.3");
}
@@ -329,14 +338,6 @@ public class ConstantEvaluatorTest extends ResolverTestCase {
assertValue(16L, "64 >> 2");
}
- public void test_stringLength_complex() throws Exception {
- assertValue(6L, "('qwe' + 'rty').length");
- }
-
- public void test_stringLength_simple() throws Exception {
- assertValue(6L, "'Dvorak'.length");
- }
-
public void test_times_double_double() throws Exception {
assertValue(2.3 * 3.2, "2.3 * 3.2");
}
@@ -379,7 +380,10 @@ public class ConstantEvaluatorTest extends ResolverTestCase {
private void assertValue(String expectedValue, String contents) throws Exception {
EvaluationResult result = getExpressionValue(contents);
DartObject value = result.getValue();
- assertEquals("String", value.getType().getName());
+ assertNotNull(value);
+ InterfaceType type = value.getType();
+ assertNotNull(type);
+ assertEquals("String", type.getName());
assertEquals(expectedValue, value.getStringValue());
}

Powered by Google App Engine
This is Rietveld 408576698