| 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 3aaf9246e62eeaffebc04550f314a240998a07b1..8b1ba91ed8516f83ee9afce3549c974988bc265f 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
|
| @@ -19,7 +19,7 @@ import com.google.dart.engine.ast.NodeList;
|
| import com.google.dart.engine.ast.TopLevelVariableDeclaration;
|
| import com.google.dart.engine.ast.VariableDeclaration;
|
| import com.google.dart.engine.element.LibraryElement;
|
| -import com.google.dart.engine.internal.resolver.TestTypeProvider;
|
| +import com.google.dart.engine.internal.context.AnalysisContextImpl;
|
| import com.google.dart.engine.resolver.ResolverTestCase;
|
| import com.google.dart.engine.source.Source;
|
|
|
| @@ -313,6 +313,10 @@ 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");
|
| }
|
| @@ -325,6 +329,14 @@ 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");
|
| }
|
| @@ -382,7 +394,9 @@ public class ConstantEvaluatorTest extends ResolverTestCase {
|
| assertInstanceOf(TopLevelVariableDeclaration.class, declaration);
|
| NodeList<VariableDeclaration> variables = ((TopLevelVariableDeclaration) declaration).getVariables().getVariables();
|
| assertSizeOfList(1, variables);
|
| - ConstantEvaluator evaluator = new ConstantEvaluator(source, new TestTypeProvider());
|
| + ConstantEvaluator evaluator = new ConstantEvaluator(
|
| + source,
|
| + ((AnalysisContextImpl) getAnalysisContext()).getTypeProvider());
|
| return evaluator.evaluate(variables.get(0).getInitializer());
|
| }
|
| }
|
|
|