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

Side by Side Diff: tests/language/multiline_newline_test.dart

Issue 1252443002: Add tests for problem with newline encoding in multiline strings. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « tests/language/multiline_newline_lf.dart ('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
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:expect/expect.dart';
6 import 'multiline_newline_cr.dart' as cr;
7 import 'multiline_newline_crlf.dart' as crlf;
8 import 'multiline_newline_lf.dart' as lf;
9
10 main() {
11 Expect.equals(4, cr.constantMultilineString.length);
12 Expect.equals(4, crlf.constantMultilineString.length);
13 Expect.equals(4, lf.constantMultilineString.length);
14 Expect.equals(cr.constantMultilineString, crlf.constantMultilineString);
15 Expect.equals(crlf.constantMultilineString, lf.constantMultilineString);
16 Expect.equals(lf.constantMultilineString, cr.constantMultilineString);
17
18 Expect.equals(4, cr.nonConstantMultilineString.length);
19 Expect.equals(4, crlf.nonConstantMultilineString.length);
20 Expect.equals(4, lf.nonConstantMultilineString.length);
21 Expect.equals(cr.nonConstantMultilineString, crlf.nonConstantMultilineString);
22 Expect.equals(crlf.nonConstantMultilineString, lf.nonConstantMultilineString);
23 Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString);
24
25 const c1 =
26 cr.constantMultilineString == crlf.constantMultilineString ? true : null;
27 const c2 =
28 crlf.constantMultilineString == lf.constantMultilineString ? true : null;
29 const c3 =
30 lf.constantMultilineString == cr.constantMultilineString ? true : null;
31 Expect.isTrue(c1);
32 Expect.isTrue(c2);
33 Expect.isTrue(c3);
34
35 const c4 = c1 ? 1 : 2; /// 01: ok
36 Expect.equals(1, c4); /// 01: continued
37
38 const c5 = c2 ? 2 : 3; /// 02: ok
39 Expect.equals(2, c5); /// 02: continued
40
41 const c6 = c3 ? 3 : 4; /// 03: ok
42 Expect.equals(3, c6); /// 03: continued
43
44 const c7 =
45 cr.constantMultilineString != crlf.constantMultilineString ? true : null;
46 const c8 =
47 crlf.constantMultilineString != lf.constantMultilineString ? true : null;
48 const c9 =
49 lf.constantMultilineString != cr.constantMultilineString ? true : null;
50 Expect.isNull(c7);
51 Expect.isNull(c8);
52 Expect.isNull(c9);
53
54 const c10 = c7 ? 1 : 2; /// 04: compile-time error
55 const c11 = c8 ? 2 : 3; /// 05: compile-time error
56 const c12 = c9 ? 3 : 4; /// 06: compile-time error
57 }
OLDNEW
« no previous file with comments | « tests/language/multiline_newline_lf.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698