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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/multiline_newline_lf.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/multiline_newline_test.dart
diff --git a/tests/language/multiline_newline_test.dart b/tests/language/multiline_newline_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f250b28b944eb911d3029ea1d0c2159c51c3b1af
--- /dev/null
+++ b/tests/language/multiline_newline_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2015, 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.
+
+import 'package:expect/expect.dart';
+import 'multiline_newline_cr.dart' as cr;
+import 'multiline_newline_crlf.dart' as crlf;
+import 'multiline_newline_lf.dart' as lf;
+
+main() {
+ Expect.equals(4, cr.constantMultilineString.length);
+ Expect.equals(4, crlf.constantMultilineString.length);
+ Expect.equals(4, lf.constantMultilineString.length);
+ Expect.equals(cr.constantMultilineString, crlf.constantMultilineString);
+ Expect.equals(crlf.constantMultilineString, lf.constantMultilineString);
+ Expect.equals(lf.constantMultilineString, cr.constantMultilineString);
+
+ Expect.equals(4, cr.nonConstantMultilineString.length);
+ Expect.equals(4, crlf.nonConstantMultilineString.length);
+ Expect.equals(4, lf.nonConstantMultilineString.length);
+ Expect.equals(cr.nonConstantMultilineString, crlf.nonConstantMultilineString);
+ Expect.equals(crlf.nonConstantMultilineString, lf.nonConstantMultilineString);
+ Expect.equals(lf.nonConstantMultilineString, cr.nonConstantMultilineString);
+
+ const c1 =
+ cr.constantMultilineString == crlf.constantMultilineString ? true : null;
+ const c2 =
+ crlf.constantMultilineString == lf.constantMultilineString ? true : null;
+ const c3 =
+ lf.constantMultilineString == cr.constantMultilineString ? true : null;
+ Expect.isTrue(c1);
+ Expect.isTrue(c2);
+ Expect.isTrue(c3);
+
+ const c4 = c1 ? 1 : 2; /// 01: ok
+ Expect.equals(1, c4); /// 01: continued
+
+ const c5 = c2 ? 2 : 3; /// 02: ok
+ Expect.equals(2, c5); /// 02: continued
+
+ const c6 = c3 ? 3 : 4; /// 03: ok
+ Expect.equals(3, c6); /// 03: continued
+
+ const c7 =
+ cr.constantMultilineString != crlf.constantMultilineString ? true : null;
+ const c8 =
+ crlf.constantMultilineString != lf.constantMultilineString ? true : null;
+ const c9 =
+ lf.constantMultilineString != cr.constantMultilineString ? true : null;
+ Expect.isNull(c7);
+ Expect.isNull(c8);
+ Expect.isNull(c9);
+
+ const c10 = c7 ? 1 : 2; /// 04: compile-time error
+ const c11 = c8 ? 2 : 3; /// 05: compile-time error
+ const c12 = c9 ? 3 : 4; /// 06: compile-time error
+}
« 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