[NFC][RISCV] Remove CFIIndex argument from allocateStack (#117871)
[llvm-project.git] / clang-tools-extra / clangd / unittests / tweaks / ObjCLocalizeStringLiteralTests.cpp
blobaf0498d85ca620f73203f17267622401329fce2d
1 //===-- ObjCLocalizeStringLiteralTests.cpp ----------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "TweakTesting.h"
10 #include "gmock/gmock.h"
11 #include "gtest/gtest.h"
13 namespace clang {
14 namespace clangd {
15 namespace {
17 TWEAK_TEST(ObjCLocalizeStringLiteral);
19 TEST_F(ObjCLocalizeStringLiteralTest, Test) {
20 ExtraArgs.push_back("-x");
21 ExtraArgs.push_back("objective-c");
23 // Ensure the action can be initiated in the string literal.
24 EXPECT_AVAILABLE(R"(id x = ^[[@[[^"^t^est^"]]]];)");
26 // Ensure that the action can't be initiated in other places.
27 EXPECT_UNAVAILABLE(R"([[i^d ^[[x]] ^= @"test";^]])");
29 // Ensure that the action is not available for regular C strings.
30 EXPECT_UNAVAILABLE(R"(const char * x= "^test";)");
32 const char *Input = R"(id x = [[@"test"]];)";
33 const char *Output = R"(id x = NSLocalizedString(@"test", @"");)";
34 EXPECT_EQ(apply(Input), Output);
37 } // namespace
38 } // namespace clangd
39 } // namespace clang