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

Unified Diff: frog/tests/leg_only/string_interpolation_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « frog/tests/leg_only/string_escape_test.dart ('k') | frog/tests/leg_only/super_call_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/tests/leg_only/string_interpolation_test.dart
===================================================================
--- frog/tests/leg_only/string_interpolation_test.dart (revision 8644)
+++ frog/tests/leg_only/string_interpolation_test.dart (working copy)
@@ -1,126 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Test that String interpolation works in the code generated by the leg
-// compiler.
-
-
-int ifun() => 37;
-double dfun() => 2.71828;
-bool bfun() => true;
-String sfun() => "sfun";
-void nfun() => null;
-
-
-void testEscapes() {
- // Test that escaping the '$' prevents string interpolation.
- String x = "NOT HERE";
- Expect.equals(@'a${x}', 'a\${x}');
- Expect.equals(@'a$x', 'a\$x');
- Expect.equals(@'a${x}', '''a\${x}''');
- Expect.equals(@'a$x', '''a\$x''');
- Expect.equals(@'a${x}', "a\${x}");
- Expect.equals(@'a$x', "a\$x");
- Expect.equals(@'a${x}', """a\${x}""");
- Expect.equals(@'a$x', """a\$x""");
-}
-
-
-void testMultiLine() {
- var a = "string";
- var b = 42;
- var c = 3.1415;
- var d = false;
- var n = null;
-
- Expect.equals("string423.1415falsenull!", """$a$b$c$d$n!""");
- Expect.equals("string423.1415falsenull!", '''$a$b$c$d$n!''');
- Expect.equals("string423.1415falsenull!", """${a}${b}${c}${d}${n}!""");
- Expect.equals("string423.1415falsenull!", '''${a}${b}${c}${d}${n}!''');
-
- // Quotes as literals are included correctly..
- Expect.equals("'42''42'", """'$b''$b'""");
- Expect.equals('"42""42"', '''"$b""$b"''');
-
- Expect.equals('"42""42" ', """"$b""$b" """);
- Expect.equals("'42''42' ", ''''$b''$b' ''');
-
- Expect.equals('""42""42" ', """""$b""$b" """);
- Expect.equals("''42''42' ", '''''$b''$b' ''');
-
- // Newlines at beginning of multiline strings are not included, but only
- // if they are in the source.
- Expect.equals("\n", """${''}
-""");
- Expect.equals("\r", """${''}
-""");
- Expect.equals("\r\n", """${''}
-""");
- Expect.equals("\n", """${'\n'}""");
- Expect.equals("\r", """${'\r'}""");
- Expect.equals("\r\n", """${'\r\n'}""");
-}
-
-
-void testSimple() {
- var a = "string";
- var b = 42;
- var c = 3.1415;
- var d = false;
- var n = null;
-
- // Both kinds of quotes and both kinds of $-escapes.
- Expect.equals("string423.1415falsenull!", "$a$b$c$d$n!");
- Expect.equals("string423.1415falsenull!", '$a$b$c$d$n!');
- Expect.equals("string423.1415falsenull!", "${a}${b}${c}${d}${n}!");
- Expect.equals("string423.1415falsenull!", '${a}${b}${c}${d}${n}!');
-
- // Different types for first expression.
- Expect.equals("!string423.1415falsenull", "!$a$b$c$d$n");
- Expect.equals("null!string423.1415false", "$n!$a$b$c$d");
- Expect.equals("falsenull!string423.1415", "$d$n!$a$b$c");
- Expect.equals("3.1415falsenull!string42", "$c$d$n!$a$b");
- Expect.equals("423.1415falsenull!string", "$b$c$d$n!$a");
-
- // Function calls as expressions.
- Expect.equals("sfun372.71828truenull",
- "${sfun()}${ifun()}${dfun()}${bfun()}${nfun()}");
- Expect.equals("nullsfun372.71828true",
- "${nfun()}${sfun()}${ifun()}${dfun()}${bfun()}");
- Expect.equals("truenullsfun372.71828",
- "${bfun()}${nfun()}${sfun()}${ifun()}${dfun()}");
- Expect.equals("2.71828truenullsfun37",
- "${dfun()}${bfun()}${nfun()}${sfun()}${ifun()}");
- Expect.equals("372.71828truenullsfun",
- "${ifun()}${dfun()}${bfun()}${nfun()}${sfun()}");
-
-
- // String contents around interpolated parts.
- Expect.equals("stringstring", "$a$a");
- Expect.equals("-stringstring", "-$a$a");
- Expect.equals("string-string", "$a-$a");
- Expect.equals("-string-string", "-$a-$a");
- Expect.equals("stringstring-", "$a$a-");
- Expect.equals("-stringstring-", "-$a$a-");
- Expect.equals("string-string-", "$a-$a-");
- Expect.equals("-string-string-", "-$a-$a-");
-
- // Quotes as literals are included correctly..
- Expect.equals("'42''42'", "'$b''$b'");
- Expect.equals('"42""42"', '"$b""$b"');
-
- // Nested string interpolation.
- Expect.equals("string423.1415false", "${'${a}'}$b${'$c${d}'}");
- // Quad-nested string interpolation.
- Expect.equals("string423.1415false", "${'${a}${"${b}${'${c}${"$d"}'}"}'}");
- // Lotsa-nested.
- Expect.equals("42", "${'${"${'${"${'${"$b"}'}"}'}"}'}");
-}
-
-
-void main() {
- testSimple();
- testMultiLine();
- testEscapes();
-}
« no previous file with comments | « frog/tests/leg_only/string_escape_test.dart ('k') | frog/tests/leg_only/super_call_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698