Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / unittests / Demangle / RustDemangleTest.cpp
blobe48ddb7ee6f010eab5a1b29b2a5e4179bd051720
1 //===------------------ RustDemangleTest.cpp ------------------------------===//
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 "llvm/Demangle/Demangle.h"
10 #include "gmock/gmock.h"
11 #include "gtest/gtest.h"
13 #include <cstdlib>
15 TEST(RustDemangle, Success) {
16 char *Demangled = llvm::rustDemangle("_RNvC1a4main");
17 EXPECT_STREQ(Demangled, "a::main");
18 std::free(Demangled);
21 TEST(RustDemangle, Invalid) {
22 char *Demangled = nullptr;
24 // Invalid prefix.
25 Demangled = llvm::rustDemangle("_ABCDEF");
26 EXPECT_EQ(Demangled, nullptr);
28 // Correct prefix but still invalid.
29 Demangled = llvm::rustDemangle("_RRR");
30 EXPECT_EQ(Demangled, nullptr);