17310403eSTomasz Miąsko //===------------------ RustDemangleTest.cpp ------------------------------===// 27310403eSTomasz Miąsko // 37310403eSTomasz Miąsko // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 47310403eSTomasz Miąsko // See https://llvm.org/LICENSE.txt for license information. 57310403eSTomasz Miąsko // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 67310403eSTomasz Miąsko // 77310403eSTomasz Miąsko //===----------------------------------------------------------------------===// 87310403eSTomasz Miąsko 97310403eSTomasz Miąsko #include "llvm/Demangle/Demangle.h" 107310403eSTomasz Miąsko #include "gmock/gmock.h" 117310403eSTomasz Miąsko #include "gtest/gtest.h" 127310403eSTomasz Miąsko 137310403eSTomasz Miąsko #include <cstdlib> 147310403eSTomasz Miąsko TEST(RustDemangle,Success)157310403eSTomasz MiąskoTEST(RustDemangle, Success) { 16*201c4b9cSNathan Sidwell char *Demangled = llvm::rustDemangle("_RNvC1a4main"); 177310403eSTomasz Miąsko EXPECT_STREQ(Demangled, "a::main"); 187310403eSTomasz Miąsko std::free(Demangled); 197310403eSTomasz Miąsko } 207310403eSTomasz Miąsko TEST(RustDemangle,Invalid)217310403eSTomasz MiąskoTEST(RustDemangle, Invalid) { 227310403eSTomasz Miąsko char *Demangled = nullptr; 237310403eSTomasz Miąsko 247310403eSTomasz Miąsko // Invalid prefix. 25*201c4b9cSNathan Sidwell Demangled = llvm::rustDemangle("_ABCDEF"); 267310403eSTomasz Miąsko EXPECT_EQ(Demangled, nullptr); 277310403eSTomasz Miąsko 287310403eSTomasz Miąsko // Correct prefix but still invalid. 29*201c4b9cSNathan Sidwell Demangled = llvm::rustDemangle("_RRR"); 307310403eSTomasz Miąsko EXPECT_EQ(Demangled, nullptr); 317310403eSTomasz Miąsko } 32