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

Side by Side Diff: tests/compiler/dart2js/string_escapes_test.dart

Issue 336413002: Allow whitespace and \ before the first newline of multiline string. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Forgot to save. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import 'compiler_helper.dart'; 8 import 'compiler_helper.dart';
9 9
10 // Test that the compiler handles string literals containing line terminators. 10 // Test that the compiler handles string literals containing line terminators.
11 11
12 Future<String> compileExpression(String expression) { 12 Future<String> compileExpression(String expression) {
13 var source = "foo() { return $expression; }"; 13 var source = "foo() { return $expression; }";
14 return compile(source, entry: "foo"); 14 return compile(source, entry: "foo");
15 } 15 }
16 16
17 main() { 17 main() {
18 asyncTest(() => Future.wait([ 18 asyncTest(() => Future.wait([
19 compileExpression("''' \n\r\u2028\u2029'''").then((String generated) { 19 compileExpression("''' \n\r\u2028\u2029'''").then((String generated) {
20 Expect.isTrue(generated.contains(r"\n\r\u2028\u2029")); 20 Expect.isTrue(generated.contains(r'"\r\u2028\u2029"') ||
21 generated.contains(r"'\r\u2028\u2029'"));
21 }), 22 }),
22 compileExpression("r''' \n\r\u2028\u2029'''").then((String generated) { 23 compileExpression("r''' \n\r\u2028\u2029'''").then((String generated) {
23 Expect.isTrue(generated.contains(r"\n\r\u2028\u2029")); 24 Expect.isTrue(generated.contains(r'"\r\u2028\u2029"') ||
25 generated.contains(r"'\r\u2028\u2029'"));
26 }),
27 compileExpression("r''' \r\n\u2028\u2029'''").then((String generated) {
28 Expect.isTrue(generated.contains(r'"\u2028\u2029"') ||
29 generated.contains(r"'\u2028\u2029'"));
30 }),
31 compileExpression("r''' \r\u2028\u2029'''").then((String generated) {
32 Expect.isTrue(generated.contains(r'"\u2028\u2029"') ||
33 generated.contains(r"'\u2028\u2029'"));
34 }),
35 compileExpression("r''' \n\u2028\u2029'''").then((String generated) {
36 Expect.isTrue(generated.contains(r'"\u2028\u2029"') ||
37 generated.contains(r"'\u2028\u2029'"));
38 }),
39 compileExpression("r'''\t\t \t\t \t\t \t \t \n\r\u2028\u2029'''")
40 .then((String generated) {
41 Expect.isTrue(generated.contains(r'"\r\u2028\u2029"') ||
42 generated.contains(r"'\r\u2028\u2029'"));
43 }),
44 compileExpression("r'''\\\t\\\t \\ \\ \t\\\t \t \\\n\r\u2028\u2029'''")
45 .then((String generated) {
46 Expect.isTrue(generated.contains(r'"\r\u2028\u2029"') ||
47 generated.contains(r"'\r\u2028\u2029'"));
48 }),
49 compileExpression("r'''\t\t \t\t \t\t \t \t \\\n\r\u2028\u2029'''")
50 .then((String generated) {
51 Expect.isTrue(generated.contains(r'"\r\u2028\u2029"') ||
52 generated.contains(r"'\r\u2028\u2029'"));
53 }),
54 compileExpression("r'''\\\t\\\t \\ \\ \t\\\t \\\r\n\u2028\u2029'''")
55 .then((String generated) {
56 Expect.isTrue(generated.contains(r'"\u2028\u2029"') ||
57 generated.contains(r"'\u2028\u2029'"));
58 }),
59 compileExpression("r'''\\\t\\\t \\ \\ \t\\\t \\\r\u2028\u2029'''")
60 .then((String generated) {
61 Expect.isTrue(generated.contains(r'"\u2028\u2029"') ||
62 generated.contains(r"'\u2028\u2029'"));
24 }), 63 }),
25 compileExpression("'\u2028\u2029'").then((String generated) { 64 compileExpression("'\u2028\u2029'").then((String generated) {
26 Expect.isTrue(generated.contains(r"\u2028\u2029")); 65 Expect.isTrue(generated.contains(r'"\u2028\u2029"') ||
66 generated.contains(r"'\u2028\u2029'"));
27 }), 67 }),
28 ])); 68 ]));
29 } 69 }
OLDNEW
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698