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

Unified Diff: tests/compiler/dart2js_extra/string_interpolation_dynamic_test.dart

Issue 171873002: Fix for interpolation codegen bug (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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: tests/compiler/dart2js_extra/string_interpolation_dynamic_test.dart
diff --git a/tests/compiler/dart2js_extra/string_interpolation_test.dart b/tests/compiler/dart2js_extra/string_interpolation_dynamic_test.dart
similarity index 88%
copy from tests/compiler/dart2js_extra/string_interpolation_test.dart
copy to tests/compiler/dart2js_extra/string_interpolation_dynamic_test.dart
index 7552214ab214c4ab3edab7137215775bb54d2f83..14ff9a5370d3908d4b13b5684a43422d2ecf3a23 100644
--- a/tests/compiler/dart2js_extra/string_interpolation_test.dart
+++ b/tests/compiler/dart2js_extra/string_interpolation_dynamic_test.dart
@@ -1,12 +1,16 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
+import 'dart:math';
// Test that String interpolation works in the code generated by the leg
// compiler.
+bool get inscrutableFalse => new Random().nextDouble() > 2;
+
+inscrutable(x) => inscrutableFalse ? [] : x;
int ifun() => 37;
double dfun() => 2.71828;
@@ -17,7 +21,7 @@ void nfun() => null;
void testEscapes() {
// Test that escaping the '$' prevents string interpolation.
- String x = "NOT HERE";
+ String x = inscrutable("NOT HERE");
Expect.equals(r'a${x}', 'a\${x}');
Expect.equals(r'a$x', 'a\$x');
Expect.equals(r'a${x}', '''a\${x}''');
@@ -30,11 +34,11 @@ void testEscapes() {
void testMultiLine() {
- var a = "string";
- var b = 42;
- var c = 3.1415;
- var d = false;
- var n = null;
+ var a = inscrutable("string");
+ var b = inscrutable(42);
+ var c = inscrutable(3.1415);
+ var d = inscrutable(false);
+ var n = inscrutable(null);
Expect.equals("string423.1415falsenull!", """$a$b$c$d$n!""");
Expect.equals("string423.1415falsenull!", '''$a$b$c$d$n!''');
@@ -65,11 +69,11 @@ void testMultiLine() {
void testSimple() {
- var a = "string";
- var b = 42;
- var c = 3.1415;
- var d = false;
- var n = null;
+ var a = inscrutable("string");
+ var b = inscrutable(42);
+ var c = inscrutable(3.1415);
+ var d = inscrutable(false);
+ var n = inscrutable(null);
// Both kinds of quotes and both kinds of $-escapes.
Expect.equals("string423.1415falsenull!", "$a$b$c$d$n!");

Powered by Google App Engine
This is Rietveld 408576698