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

Side by Side Diff: tests/language/src/StringInterpolate2Test.dart

Issue 8231031: Check for compile-time constants in DartCompiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: All tests pass but one junit test Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program testing string interpolation of expressions. 4 // Dart test program testing string interpolation of expressions.
5 5
6 6
7 class StringInterpolate2Test { 7 class StringInterpolate2Test {
8 8
9 static final F1 = "1 + 5 = ${1+5}"; 9 // String interpolation not valid on compile time constants
10 // static final F1 = "1 + 5 = ${1+5}";
10 11
11 static void testMain() { 12 static void testMain() {
12 13
14 var F1 = "1 + 5 = ${1+5}";
15
13 Expect.equals("1 + 5 = 6", F1); 16 Expect.equals("1 + 5 = 6", F1);
14 17
15 var fib = [1, 1, 2, 3, 5, 8, 13, 21]; 18 var fib = [1, 1, 2, 3, 5, 8, 13, 21];
16 19
17 var i = 5; 20 var i = 5;
18 var s = "${i}"; 21 var s = "${i}";
19 Expect.equals("5", s); 22 Expect.equals("5", s);
20 23
21 s = "fib(${i}) = ${fib[i]}"; 24 s = "fib(${i}) = ${fib[i]}";
22 Expect.equals("fib(5) = 8", s); 25 Expect.equals("fib(5) = 8", s);
(...skipping 19 matching lines...) Expand all
42 // multiline string types 45 // multiline string types
43 s = "a ${(){ return 'b ${(){ return """ 46 s = "a ${(){ return 'b ${(){ return """
44 c""";}()}'; }()} d"; 47 c""";}()}'; }()} d";
45 Expect.equals("a b c d", s); 48 Expect.equals("a b c d", s);
46 } 49 }
47 } 50 }
48 51
49 main() { 52 main() {
50 StringInterpolate2Test.testMain(); 53 StringInterpolate2Test.testMain();
51 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698