[test] Rename deprecated gtest method

The old name was marked as deprecated and failing to build with clang.
This commit is contained in:
Thiago Marcos P. Santos
2020-04-07 21:55:19 +03:00
parent e3485c2df1
commit 42dc1e997f
2 changed files with 40 additions and 38 deletions

View File

@@ -79,28 +79,29 @@ TEST_P(ExpressionEqualityTest, ExpressionEquality) {
EXPECT_TRUE(*expression_a1 != *expression_b);
}
INSTANTIATE_TEST_CASE_P(Expression, ExpressionEqualityTest, ::testing::ValuesIn([] {
std::vector<std::string> names;
const std::string ending = ".a.json";
INSTANTIATE_TEST_SUITE_P(Expression, ExpressionEqualityTest, ::testing::ValuesIn([] {
std::vector<std::string> names;
const std::string ending = ".a.json";
const std::string style_directory = "test/fixtures/expression_equality";
DIR *dir = opendir(style_directory.c_str());
if (dir != nullptr) {
for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
const std::string name = dp->d_name;
const std::string style_directory = "test/fixtures/expression_equality";
DIR* dir = opendir(style_directory.c_str());
if (dir != nullptr) {
for (dirent* dp = nullptr; (dp = readdir(dir)) != nullptr;) {
const std::string name = dp->d_name;
#if ANDROID
// Android unit test uses number-format stub implementation so skip the tests
if (name.find("number-format") != std::string::npos) {
continue;
}
// Android unit test uses number-format stub implementation so skip the tests
if (name.find("number-format") != std::string::npos) {
continue;
}
#endif
if (name.length() >= ending.length() && name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
names.push_back(name.substr(0, name.length() - ending.length()));
}
}
closedir(dir);
}
if (name.length() >= ending.length() &&
name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
names.push_back(name.substr(0, name.length() - ending.length()));
}
}
closedir(dir);
}
EXPECT_GT(names.size(), 0u);
return names;
}()));
EXPECT_GT(names.size(), 0u);
return names;
}()));

View File

@@ -74,25 +74,26 @@ TEST_P(StyleParserTest, ParseStyle) {
}
}
INSTANTIATE_TEST_CASE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] {
std::vector<std::string> names;
const std::string ending = ".info.json";
INSTANTIATE_TEST_SUITE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] {
std::vector<std::string> names;
const std::string ending = ".info.json";
const std::string style_directory = "test/fixtures/style_parser";
DIR *dir = opendir(style_directory.c_str());
if (dir != nullptr) {
for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
const std::string name = dp->d_name;
if (name.length() >= ending.length() && name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
names.push_back(name.substr(0, name.length() - ending.length()));
}
}
closedir(dir);
}
const std::string style_directory = "test/fixtures/style_parser";
DIR *dir = opendir(style_directory.c_str());
if (dir != nullptr) {
for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
const std::string name = dp->d_name;
if (name.length() >= ending.length() &&
name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
names.push_back(name.substr(0, name.length() - ending.length()));
}
}
closedir(dir);
}
EXPECT_GT(names.size(), 0u);
return names;
}()));
EXPECT_GT(names.size(), 0u);
return names;
}()));
TEST(StyleParser, FontStacks) {
style::Parser parser;