DemangleTest.cpp 928 B

123456789101112131415161718192021222324
  1. //===-- DemangleTest.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. //===----------------------------------------------------------------------===//
  8. #include "llvm/Demangle/Demangle.h"
  9. #include "gmock/gmock.h"
  10. using namespace llvm;
  11. TEST(Demangle, demangleTest) {
  12. EXPECT_EQ(demangle("_"), "_");
  13. EXPECT_EQ(demangle("_Z3fooi"), "foo(int)");
  14. EXPECT_EQ(demangle("__Z3fooi"), "foo(int)");
  15. EXPECT_EQ(demangle("___Z3fooi_block_invoke"),
  16. "invocation function for block in foo(int)");
  17. EXPECT_EQ(demangle("____Z3fooi_block_invoke"),
  18. "invocation function for block in foo(int)");
  19. EXPECT_EQ(demangle("?foo@@YAXH@Z"), "void __cdecl foo(int)");
  20. EXPECT_EQ(demangle("foo"), "foo");
  21. }