2011-10-05 06:22:36 +00:00
|
|
|
// 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.
|
|
|
|
|
2015-06-26 12:40:01 +00:00
|
|
|
// Note: This test relies on LF line endings in the source file.
|
|
|
|
|
2013-04-05 19:43:16 +00:00
|
|
|
import "package:expect/expect.dart";
|
|
|
|
|
2011-10-05 06:22:36 +00:00
|
|
|
class RawStringTest {
|
|
|
|
static testMain() {
|
2012-09-11 22:53:45 +00:00
|
|
|
Expect.equals("abcd", r"abcd");
|
|
|
|
Expect.equals("", r"");
|
|
|
|
Expect.equals("", r'');
|
|
|
|
Expect.equals("", r"""""");
|
|
|
|
Expect.equals("", r'''''');
|
|
|
|
Expect.equals("''''", r"''''");
|
|
|
|
Expect.equals('""""', r'""""');
|
|
|
|
Expect.equals("1\n2\n3", r"""1
|
2011-10-05 06:22:36 +00:00
|
|
|
2
|
|
|
|
3""");
|
2012-09-11 22:53:45 +00:00
|
|
|
Expect.equals("1\n2\n3", r'''1
|
2011-10-05 06:22:36 +00:00
|
|
|
2
|
|
|
|
3''');
|
2012-09-11 22:53:45 +00:00
|
|
|
Expect.equals("1", r"""
|
2011-10-05 06:22:36 +00:00
|
|
|
1""");
|
2012-09-11 22:53:45 +00:00
|
|
|
Expect.equals("1", r'''
|
2011-10-05 06:22:36 +00:00
|
|
|
1''');
|
2012-09-11 22:53:45 +00:00
|
|
|
Expect.equals("'", r"'");
|
|
|
|
Expect.equals('"', r'"');
|
|
|
|
Expect.equals("1", r"1");
|
|
|
|
Expect.equals("1", r"1");
|
|
|
|
Expect.equals("\$", r"$");
|
|
|
|
Expect.equals("\\", r"\");
|
|
|
|
Expect.equals("\\", r'\');
|
|
|
|
Expect.equals("\${12}", r"${12}");
|
2011-10-05 06:22:36 +00:00
|
|
|
Expect.equals("\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m",
|
2012-09-11 22:53:45 +00:00
|
|
|
r"\a\b\c\d\e\f\g\h\i\j\k\l\m");
|
2011-10-05 06:22:36 +00:00
|
|
|
Expect.equals("\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z",
|
2012-09-11 22:53:45 +00:00
|
|
|
r"\n\o\p\q\r\s\t\u\v\w\x\y\z");
|
2011-10-05 06:22:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
main() {
|
|
|
|
RawStringTest.testMain();
|
|
|
|
}
|