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

Unified Diff: pkg/analyzer/test/src/dart/ast/utilities_test.dart

Issue 2586363004: Support + concatenation in constant expressions with strings (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/dart/ast/utilities_test.dart
diff --git a/pkg/analyzer/test/src/dart/ast/utilities_test.dart b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
index 368c30700e55876299c1f7c669e4f566cfc9aa2b..c0ae90a28db0444b99c11d17008e15a14889f9d6 100644
--- a/pkg/analyzer/test/src/dart/ast/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
@@ -196,6 +196,11 @@ class ConstantEvaluatorTest extends ParserTestCase {
expect(value, true);
}
+ void test_binary_plus_string() {
+ Object value = _getConstantValue("'hello ' + 'world'");
+ expect(value, 'hello world');
+ }
+
void test_binary_plus_double() {
Object value = _getConstantValue("2.3 + 3.2");
expect(value, 2.3 + 3.2);
@@ -206,6 +211,11 @@ class ConstantEvaluatorTest extends ParserTestCase {
expect(value, 5);
}
+ void test_binary_plus_string_mixed() {
scheglov 2016/12/22 23:22:54 Maybe worth to test when both case for num/string
mfairhurst 2016/12/23 00:04:41 Acknowledged.
+ Object value = _getConstantValue("5 + 'world'");
+ expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+ }
+
void test_binary_remainder_double() {
Object value = _getConstantValue("3.2 % 2.3");
expect(value, 3.2 % 2.3);
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698