1 //===-- RawStringLiteralTests.cpp -------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "TweakTesting.h"
10 #include "gmock/gmock-matchers.h"
11 #include "gmock/gmock.h"
12 #include "gtest/gtest.h"
18 TWEAK_TEST(RawStringLiteral
);
20 TEST_F(RawStringLiteralTest
, Test
) {
22 EXPECT_AVAILABLE(R
"cpp(^"^f
^o
^o
^\
^n
^")cpp");
23 EXPECT_AVAILABLE(R
"cpp(R"(multi
)" ^"token
" "str
\ning
")cpp");
24 EXPECT_UNAVAILABLE(R
"cpp(^"f
^o
^o
^o
")cpp"); // no chars need escaping
25 EXPECT_UNAVAILABLE(R
"cpp(R"(multi
)" ^"token
" u8"str
\ning
")cpp"); // nonascii
26 EXPECT_UNAVAILABLE(R
"cpp(^R^"^(^multi
)" "token
" "str
\ning
")cpp"); // raw
27 EXPECT_UNAVAILABLE(R
"cpp(^"token
\n" __FILE__)cpp"); // chunk is macro
28 EXPECT_UNAVAILABLE(R
"cpp(^"a
\r\n";)cpp"); // forbidden escape char
30 const char *Input
= R
"cpp(R"(multi
31 token
)" "\nst
^ring
\n" "literal
")cpp";
32 const char *Output
= R
"cpp(R"(multi
36 EXPECT_EQ(apply(Input
), Output
);