mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
tests: add a unit test for demangling the new swift prefix with libswiftDemangle
This commit is contained in:
@@ -38,6 +38,26 @@ TEST(FunctionNameDemangleTests, CorrectlyDemangles) {
|
||||
EXPECT_EQ(Result, strlen(DemangledNameWithSugar));
|
||||
}
|
||||
|
||||
TEST(FunctionNameDemangleTests, NewManglingPrefix) {
|
||||
char OutputBuffer[128];
|
||||
|
||||
const char *FunctionName = "$S1a10run_MatMulyySiF";
|
||||
const char *DemangledName = "a.run_MatMul(Swift.Int) -> ()";
|
||||
const char *SimplifiedName = "run_MatMul(_:)";
|
||||
|
||||
size_t Result = swift_demangle_getDemangledName(FunctionName, OutputBuffer,
|
||||
sizeof(OutputBuffer));
|
||||
|
||||
EXPECT_STREQ(DemangledName, OutputBuffer);
|
||||
EXPECT_EQ(Result, strlen(DemangledName));
|
||||
|
||||
Result = swift_demangle_getSimplifiedDemangledName(FunctionName, OutputBuffer,
|
||||
sizeof(OutputBuffer));
|
||||
|
||||
EXPECT_STREQ(SimplifiedName, OutputBuffer);
|
||||
EXPECT_EQ(Result, strlen(SimplifiedName));
|
||||
}
|
||||
|
||||
TEST(FunctionNameDemangledTests, WorksWithNULLBuffer) {
|
||||
const char *FunctionName = "_TFC3foo3bar3basfT3zimCS_3zim_T_";
|
||||
const char *DemangledName = "foo.bar.bas(zim: foo.zim) -> ()";
|
||||
|
||||
Reference in New Issue
Block a user