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

Side by Side Diff: frog/tests/leg/src/BuiltinInterceptorTest.dart

Issue 9190038: Handle escapes in string literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed validation from scanner Created 8 years, 11 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 | « frog/leg/util/characters.dart ('k') | frog/tests/leg/src/ScannerTest.dart » ('j') | 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("compiler_helper.dart"); 5 #import("compiler_helper.dart");
6 6
7 final String TEST_ONE = @""" 7 final String TEST_ONE = @"""
8 foo(String a) { 8 foo(String a) {
9 return a.length; 9 return a.length;
10 } 10 }
11 """; 11 """;
12 12
13 final String TEST_TWO = @""" 13 final String TEST_TWO = @"""
14 foo() { 14 foo() {
15 return "foo".length; 15 return "foo".length;
16 } 16 }
17 """; 17 """;
18 18
19 final String TEST_THREE = @""" 19 final String TEST_THREE = @"""
20 foo() { 20 foo() {
21 return @"foo".length; 21 return @"foo".length;
22 } 22 }
23 """; 23 """;
24 24
25 main() { 25 main() {
26 String generated = compile(TEST_ONE, 'foo'); 26 String generated = compile(TEST_ONE, 'foo');
27 Expect.isTrue(generated.contains("return a.length;")); 27 Expect.isTrue(generated.contains("return a.length;"));
28 28
29 // TODO(ngeoffray): Enable once we support raw strings 29 // TODO(lrn): Switch these two to isTrue when we support constant folding
30 // and folding of length. 30 // of string length.
31 Exception exception; 31 generated = compile(TEST_TWO, 'foo');
32 try { 32 Expect.isFalse(generated.contains("return 3;"));
33 generated = compile(TEST_TWO, 'foo');
34 Expect.isTrue(generated.contains("return 3;"));
35 33
36 generated = compile(TEST_THREE, 'foo'); 34 generated = compile(TEST_THREE, 'foo');
37 Expect.isTrue(generated.contains("return 3;")); 35 Expect.isFalse(generated.contains("return 3;"));
38 } catch (var e) {
39 exception = e;
40 }
41 Expect.isTrue(exception != null);
42 } 36 }
OLDNEW
« no previous file with comments | « frog/leg/util/characters.dart ('k') | frog/tests/leg/src/ScannerTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698