summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/TextAPI/TextStubV2Tests.cpp17
-rw-r--r--llvm/unittests/TextAPI/TextStubV3Tests.cpp37
2 files changed, 54 insertions, 0 deletions
diff --git a/llvm/unittests/TextAPI/TextStubV2Tests.cpp b/llvm/unittests/TextAPI/TextStubV2Tests.cpp
index 0a75fb2fce2..1cc622bc450 100644
--- a/llvm/unittests/TextAPI/TextStubV2Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV2Tests.cpp
@@ -457,6 +457,23 @@ TEST(TBDv2, UnknownPlatform) {
errorMessage);
}
+TEST(TBDv2, InvalidPlatform) {
+ static const char tbd_v2_file_invalid_platform[] =
+ "--- !tapi-tbd-v2\n"
+ "archs: [ i386 ]\n"
+ "platform: iosmac\n"
+ "install-name: Test.dylib\n"
+ "...\n";
+
+ auto Result = TextAPIReader::get(
+ MemoryBufferRef(tbd_v2_file_invalid_platform, "Test.tbd"));
+ EXPECT_FALSE(!!Result);
+ auto errorMessage = toString(Result.takeError());
+ EXPECT_EQ("malformed file\nTest.tbd:3:11: error: invalid platform\nplatform: "
+ "iosmac\n ^~~~~~\n",
+ errorMessage);
+}
+
TEST(TBDv2, MalformedFile1) {
static const char malformed_file1[] = "--- !tapi-tbd-v2\n"
"archs: [ arm64 ]\n"
diff --git a/llvm/unittests/TextAPI/TextStubV3Tests.cpp b/llvm/unittests/TextAPI/TextStubV3Tests.cpp
index 10d76b5b8fe..c8b16dbb7d7 100644
--- a/llvm/unittests/TextAPI/TextStubV3Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV3Tests.cpp
@@ -274,6 +274,43 @@ TEST(TBDv3, Platform_bridgeOS) {
EXPECT_EQ(Platform, *File->getPlatforms().begin());
}
+TEST(TBDv3, Platform_macCatalyst) {
+ static const char tbd_v1_platform_iosmac[] = "--- !tapi-tbd-v3\n"
+ "archs: [ armv7k ]\n"
+ "platform: iosmac\n"
+ "install-name: Test.dylib\n"
+ "...\n";
+
+ auto Result =
+ TextAPIReader::get(MemoryBufferRef(tbd_v1_platform_iosmac, "Test.tbd"));
+ EXPECT_TRUE(!!Result);
+ auto Platform = PlatformKind::macCatalyst;
+ auto File = std::move(Result.get());
+ EXPECT_EQ(FileType::TBD_V3, File->getFileType());
+ EXPECT_EQ(Platform, *File->getPlatforms().begin());
+}
+
+TEST(TBDv3, Platform_zippered) {
+ static const char tbd_v1_platform_zip[] = "--- !tapi-tbd-v3\n"
+ "archs: [ armv7k ]\n"
+ "platform: zippered\n"
+ "install-name: Test.dylib\n"
+ "...\n";
+
+ auto Result =
+ TextAPIReader::get(MemoryBufferRef(tbd_v1_platform_zip, "Test.tbd"));
+ EXPECT_TRUE(!!Result);
+ auto File = std::move(Result.get());
+ EXPECT_EQ(FileType::TBD_V3, File->getFileType());
+
+ PlatformSet Platforms;
+ Platforms.insert(PlatformKind::macOS);
+ Platforms.insert(PlatformKind::macCatalyst);
+ EXPECT_EQ(Platforms.size(), File->getPlatforms().size());
+ for (auto Platform : File->getPlatforms())
+ EXPECT_EQ(Platforms.count(Platform), 1U);
+}
+
TEST(TBDv3, Swift_1_0) {
static const char tbd_v1_swift_1_0[] = "--- !tapi-tbd-v3\n"
"archs: [ arm64 ]\n"
OpenPOWER on IntegriCloud