TEST_F(AppsTests, test_parse_info_plist) { QueryData results; // Generate a set of results/single row using an example tree. auto tree = getInfoPlistTree(); genApplication(tree, "/Applications/Foobar.app/Contents/Info.plist", results); ASSERT_EQ(results.size(), 1); ASSERT_EQ(results[0].count("name"), 1); Row expected = { {"name", "Foobar.app"}, {"path", "/Applications/Foobar.app"}, {"bundle_executable", "Photo Booth"}, {"bundle_identifier", "com.apple.PhotoBooth"}, {"bundle_name", ""}, {"bundle_short_version", "6.0"}, {"bundle_version", "517"}, {"bundle_package_type", "APPL"}, {"environment", ""}, {"element", ""}, {"compiler", "com.apple.compilers.llvm.clang.1_0"}, {"development_region", "English"}, {"display_name", ""}, {"info_string", ""}, {"minimum_system_version", "10.7.0"}, {"category", "public.app-category.entertainment"}, {"applescript_enabled", ""}, {"copyright", ""}, }; // We could compare the entire map, but iterating the columns will produce // better error text as most likely parsing for a certain column/type changed. for (const auto& column : expected) { EXPECT_EQ(results[0][column.first], column.second); } }
TEST_F(AppsTests, test_parse_info_plist) { auto tree = getInfoPlistTree(); Row expected = { {"name", "Foobar.app"}, {"path", "/Applications/Foobar.app"}, {"bundle_executable", "Photo Booth"}, {"bundle_identifier", "com.apple.PhotoBooth"}, {"bundle_name", ""}, {"bundle_short_version", "6.0"}, {"bundle_version", "517"}, {"bundle_package_type", "APPL"}, {"compiler", "com.apple.compilers.llvm.clang.1_0"}, {"development_region", "English"}, {"display_name", ""}, {"info_string", ""}, {"minimum_system_version", "10.7.0"}, {"category", "public.app-category.entertainment"}, {"applescript_enabled", ""}, {"copyright", ""}, }; EXPECT_EQ( parseInfoPlist("/Applications/Foobar.app/Contents/Info.plist", tree), expected); }