Replace deprecated Google Test API INSTANTIATE_TEST_CASE_P() (!117)

When compiling the tests, this warning is reported:

    $ make check
    ... warning: ...: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P [-Wdeprecated-declarations]
       static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
                                          ^
    test_SupportedFileSystems.cc:625:1: note: in expansion of macro 'INSTANTIATE_TEST_CASE_P'

Google Test 1.10.0 release notes [1] say:
    High Level Changes:
    This release deprecated "....TEST_CASE" API in favor of
    "....TEST_SUITE".  In a nutshell if you have code that uses
    something like "INSTANTIATE_TYPED_TEST_CASE_P " - this and all other
    "*_TEST_CASE " are now deprecated in favor of more standard
    _TEST_SUITE.

Replace the deprecated API with the new API.

[1] Google Test release v1.10.0
    https://github.com/google/googletest/releases/tag/release-1.10.0

Closes !117 - Require C++11 compilation
This commit is contained in:
Mike Fleetwood 2023-09-03 12:32:53 +01:00 committed by Curtis Gedak
parent 1ccb782156
commit 2febe04665
2 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ BEGIN {
#printf "DEBUG: test_name[%d]=\"%s\"\n", num_tests, test_name[num_tests]
num_tests++
}
/^INSTANTIATE_TEST_CASE_P/ {
/^INSTANTIATE_TEST_SUITE_P/ {
# Save instantiation name.
instance_name = $2
}

View File

@ -95,8 +95,8 @@ const std::string test_fsname(FSType fstype)
}
// Function callable by INSTANTIATE_TEST_CASE_P() to get the file system type for printing
// as part of the test name.
// Function callable by INSTANTIATE_TEST_SUITE_P() to get the file system type for
// printing as part of the test name.
const std::string param_fsname(const ::testing::TestParamInfo<FSType>& info)
{
return test_fsname(info.param);
@ -621,11 +621,11 @@ TEST_P(SupportedFileSystemsTest, CreateAndShrink)
// Instantiate the test case so every test is run for the specified file system types.
// Reference:
// * Google Test, Advanced googletest Topics, How to Write Value-Parameterized Tests
// https://github.com/google/googletest/blob/v1.8.x/googletest/docs/advanced.md#how-to-write-value-parameterized-tests
INSTANTIATE_TEST_CASE_P(My,
SupportedFileSystemsTest,
::testing::ValuesIn(SupportedFileSystemsTest::get_supported_fstypes()),
param_fsname);
// https://github.com/google/googletest/blob/v1.10.x/googletest/docs/advanced.md#how-to-write-value-parameterized-tests
INSTANTIATE_TEST_SUITE_P(My,
SupportedFileSystemsTest,
::testing::ValuesIn(SupportedFileSystemsTest::get_supported_fstypes()),
param_fsname);
} // namespace GParted