mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[llvm][TextAPI/MachO] silence clang-tidy warnings, NFC
* applies only to tests
This commit is contained in:
parent
b72287bdfc
commit
dbf20123ca
@ -34,7 +34,7 @@ static ExportedSymbol TBDv4UndefinedSymbols[] = {
|
||||
namespace TBDv4 {
|
||||
|
||||
TEST(TBDv4, ReadFile) {
|
||||
static const char tbd_v4_file[] =
|
||||
static const char TBDv4File[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ i386-macos, x86_64-macos, x86_64-ios ]\n"
|
||||
@ -89,7 +89,7 @@ TEST(TBDv4, ReadFile) {
|
||||
" thread-local-symbols: []\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbd_v4_file, "Test.tbd"));
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(TBDv4File, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -156,7 +156,7 @@ TEST(TBDv4, ReadFile) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, WriteFile) {
|
||||
static const char tbd_v4_file[] =
|
||||
static const char TBDv4File[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ i386-macos, x86_64-ios-simulator ]\n"
|
||||
@ -215,11 +215,11 @@ TEST(TBDv4, WriteFile) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto Result = TextAPIWriter::writeToStream(OS, File);
|
||||
EXPECT_FALSE(Result);
|
||||
EXPECT_STREQ(tbd_v4_file, Buffer.c_str());
|
||||
EXPECT_STREQ(TBDv4File, Buffer.c_str());
|
||||
}
|
||||
|
||||
TEST(TBDv4, MultipleTargets) {
|
||||
static const char tbd_multiple_targets[] =
|
||||
static const char TBDv4MultipleTargets[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ i386-maccatalyst, x86_64-tvos, arm64-ios ]\n"
|
||||
@ -227,7 +227,7 @@ TEST(TBDv4, MultipleTargets) {
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_multiple_targets, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4MultipleTargets, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
PlatformSet Platforms;
|
||||
Platforms.insert(PlatformKind::macCatalyst);
|
||||
@ -244,12 +244,12 @@ TEST(TBDv4, MultipleTargets) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_multiple_targets),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4MultipleTargets),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, MultipleTargetsSameArch) {
|
||||
static const char tbd_targets_same_arch[] =
|
||||
static const char TBDv4TargetsSameArch[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-tvos , x86_64-maccatalyst ]\n"
|
||||
@ -257,7 +257,7 @@ TEST(TBDv4, MultipleTargetsSameArch) {
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_targets_same_arch, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4TargetsSameArch, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
PlatformSet Platforms;
|
||||
Platforms.insert(PlatformKind::tvOS);
|
||||
@ -273,12 +273,12 @@ TEST(TBDv4, MultipleTargetsSameArch) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_targets_same_arch),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4TargetsSameArch),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, MultipleTargetsSamePlatform) {
|
||||
static const char tbd_multiple_targets_same_platform[] =
|
||||
static const char TBDv4MultipleTargetsSamePlatform[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ armv7k-ios , arm64-ios]\n"
|
||||
@ -286,7 +286,7 @@ TEST(TBDv4, MultipleTargetsSamePlatform) {
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(
|
||||
MemoryBufferRef(tbd_multiple_targets_same_platform, "Test.tbd"));
|
||||
MemoryBufferRef(TBDv4MultipleTargetsSamePlatform, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -298,12 +298,12 @@ TEST(TBDv4, MultipleTargetsSamePlatform) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_multiple_targets_same_platform),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4MultipleTargetsSamePlatform),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_maccatalyst) {
|
||||
static const char tbd_target_maccatalyst[] =
|
||||
static const char TBDv4TargetMacCatalyst[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-maccatalyst ]\n"
|
||||
@ -311,7 +311,7 @@ TEST(TBDv4, Target_maccatalyst) {
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_target_maccatalyst, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4TargetMacCatalyst, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -323,19 +323,19 @@ TEST(TBDv4, Target_maccatalyst) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_target_maccatalyst),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4TargetMacCatalyst),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_x86_ios) {
|
||||
static const char tbd_target_x86_ios[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-ios ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4Targetx86iOS[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-ios ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_target_x86_ios, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4Targetx86iOS, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -347,19 +347,19 @@ TEST(TBDv4, Target_x86_ios) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_target_x86_ios),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4Targetx86iOS),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_arm_bridgeOS) {
|
||||
static const char tbd_platform_bridgeos[] = "--- !tapi-tbd\n"
|
||||
static const char TBDv4PlatformBridgeOS[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ armv7k-bridgeos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_platform_bridgeos, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4PlatformBridgeOS, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -371,18 +371,19 @@ TEST(TBDv4, Target_arm_bridgeOS) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_platform_bridgeos),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4PlatformBridgeOS),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_arm_iOS) {
|
||||
static const char tbdv4_arm64e[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ arm64e-ios ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4ArchArm64e[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ arm64e-ios ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbdv4_arm64e, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4ArchArm64e, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -394,17 +395,18 @@ TEST(TBDv4, Target_arm_iOS) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbdv4_arm64e), stripWhitespace(Buffer.c_str()));
|
||||
EXPECT_EQ(stripWhitespace(TBDv4ArchArm64e), stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_x86_macos) {
|
||||
static const char tbd_x86_macos[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4Targetx86MacOS[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbd_x86_macos, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4Targetx86MacOS, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -416,18 +418,20 @@ TEST(TBDv4, Target_x86_macos) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_x86_macos), stripWhitespace(Buffer.c_str()));
|
||||
EXPECT_EQ(stripWhitespace(TBDv4Targetx86MacOS),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_x86_ios_simulator) {
|
||||
static const char tbd_x86_ios_sim[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-ios-simulator ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4Targetx86iOSSim[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-ios-simulator ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_x86_ios_sim, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4Targetx86iOSSim, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -439,19 +443,19 @@ TEST(TBDv4, Target_x86_ios_simulator) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_x86_ios_sim), stripWhitespace(Buffer.c_str()));
|
||||
EXPECT_EQ(stripWhitespace(TBDv4Targetx86iOSSim),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_x86_tvos_simulator) {
|
||||
static const char tbd_x86_tvos_sim[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-tvos-simulator ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4x86tvOSSim[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-tvos-simulator ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_x86_tvos_sim, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4x86tvOSSim, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -463,11 +467,11 @@ TEST(TBDv4, Target_x86_tvos_simulator) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_x86_tvos_sim), stripWhitespace(Buffer.c_str()));
|
||||
EXPECT_EQ(stripWhitespace(TBDv4x86tvOSSim), stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Target_i386_watchos_simulator) {
|
||||
static const char tbd_i386_watchos_sim[] =
|
||||
static const char TBDv4i386watchOSSim[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ i386-watchos-simulator ]\n"
|
||||
@ -475,7 +479,7 @@ TEST(TBDv4, Target_i386_watchos_simulator) {
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_i386_watchos_sim, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4i386watchOSSim, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -487,19 +491,20 @@ TEST(TBDv4, Target_i386_watchos_simulator) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_i386_watchos_sim),
|
||||
EXPECT_EQ(stripWhitespace(TBDv4i386watchOSSim),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Swift_1) {
|
||||
static const char tbd_swift_1[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 1\n"
|
||||
"...\n";
|
||||
static const char TBDv4SwiftVersion1[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 1\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbd_swift_1, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4SwiftVersion1, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -509,14 +514,14 @@ TEST(TBDv4, Swift_1) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, Swift_2) {
|
||||
static const char tbd_v4_swift_2[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 2\n"
|
||||
"...\n";
|
||||
static const char TBDv4Swift2[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 2\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbd_v4_swift_2, "Test.tbd"));
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(TBDv4Swift2, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -526,14 +531,15 @@ TEST(TBDv4, Swift_2) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, Swift_5) {
|
||||
static const char tbd_swift_5[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 5\n"
|
||||
"...\n";
|
||||
static const char TBDv4SwiftVersion5[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 5\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbd_swift_5, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4SwiftVersion5, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -543,18 +549,20 @@ TEST(TBDv4, Swift_5) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_swift_5), stripWhitespace(Buffer.c_str()));
|
||||
EXPECT_EQ(stripWhitespace(TBDv4SwiftVersion5),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, Swift_99) {
|
||||
static const char tbd_swift_99[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 99\n"
|
||||
"...\n";
|
||||
static const char TBDv4SwiftVersion99[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 99\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(MemoryBufferRef(tbd_swift_99, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4SwiftVersion99, "Test.tbd"));
|
||||
EXPECT_TRUE(!!Result);
|
||||
auto File = std::move(Result.get());
|
||||
EXPECT_EQ(FileType::TBD_V4, File->getFileType());
|
||||
@ -564,19 +572,19 @@ TEST(TBDv4, Swift_99) {
|
||||
raw_svector_ostream OS(Buffer);
|
||||
auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
|
||||
EXPECT_TRUE(!WriteResult);
|
||||
EXPECT_EQ(stripWhitespace(tbd_swift_99), stripWhitespace(Buffer.c_str()));
|
||||
EXPECT_EQ(stripWhitespace(TBDv4SwiftVersion99),
|
||||
stripWhitespace(Buffer.c_str()));
|
||||
}
|
||||
|
||||
TEST(TBDv4, InvalidArchitecture) {
|
||||
static const char tbd_file_unknown_architecture[] =
|
||||
"--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ foo-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4UnknownArch[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ foo-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(
|
||||
MemoryBufferRef(tbd_file_unknown_architecture, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4UnknownArch, "Test.tbd"));
|
||||
EXPECT_FALSE(!!Result);
|
||||
auto errorMessage = toString(Result.takeError());
|
||||
EXPECT_EQ("malformed file\nTest.tbd:3:12: error: unknown "
|
||||
@ -586,14 +594,14 @@ TEST(TBDv4, InvalidArchitecture) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, InvalidPlatform) {
|
||||
static const char tbd_file_invalid_platform[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-maos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
static const char TBDv4FInvalidPlatform[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-maos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"...\n";
|
||||
|
||||
auto Result = TextAPIReader::get(
|
||||
MemoryBufferRef(tbd_file_invalid_platform, "Test.tbd"));
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4FInvalidPlatform, "Test.tbd"));
|
||||
EXPECT_FALSE(!!Result);
|
||||
auto errorMessage = toString(Result.takeError());
|
||||
EXPECT_EQ("malformed file\nTest.tbd:3:12: error: unknown platform\ntargets: "
|
||||
@ -603,12 +611,12 @@ TEST(TBDv4, InvalidPlatform) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, MalformedFile1) {
|
||||
static const char malformed_file1[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"...\n";
|
||||
static const char TBDv4MalformedFile1[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(malformed_file1, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4MalformedFile1, "Test.tbd"));
|
||||
EXPECT_FALSE(!!Result);
|
||||
auto errorMessage = toString(Result.takeError());
|
||||
ASSERT_EQ("malformed file\nTest.tbd:2:1: error: missing required key "
|
||||
@ -617,14 +625,14 @@ TEST(TBDv4, MalformedFile1) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, MalformedFile2) {
|
||||
static const char malformed_file2[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"foobar: \"unsupported key\"\n";
|
||||
static const char TBDv4MalformedFile2[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"foobar: \"unsupported key\"\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(malformed_file2, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4MalformedFile2, "Test.tbd"));
|
||||
EXPECT_FALSE(!!Result);
|
||||
auto errorMessage = toString(Result.takeError());
|
||||
ASSERT_EQ(
|
||||
@ -634,15 +642,15 @@ TEST(TBDv4, MalformedFile2) {
|
||||
}
|
||||
|
||||
TEST(TBDv4, MalformedFile3) {
|
||||
static const char tbd_v4_swift_1_1[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 1.1\n"
|
||||
"...\n";
|
||||
static const char TBDv4MalformedSwift[] = "--- !tapi-tbd\n"
|
||||
"tbd-version: 4\n"
|
||||
"targets: [ x86_64-macos ]\n"
|
||||
"install-name: Test.dylib\n"
|
||||
"swift-abi-version: 1.1\n"
|
||||
"...\n";
|
||||
|
||||
auto Result =
|
||||
TextAPIReader::get(MemoryBufferRef(tbd_v4_swift_1_1, "Test.tbd"));
|
||||
TextAPIReader::get(MemoryBufferRef(TBDv4MalformedSwift, "Test.tbd"));
|
||||
EXPECT_FALSE(!!Result);
|
||||
auto errorMessage = toString(Result.takeError());
|
||||
EXPECT_EQ("malformed file\nTest.tbd:5:20: error: invalid Swift ABI "
|
||||
|
Loading…
Reference in New Issue
Block a user