From 2febe04665ff829b4ace742873ad40e27a1f0660 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sun, 3 Sep 2023 12:32:53 +0100 Subject: [PATCH] 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 --- tests/exclude_loopdev_tests.sh | 2 +- tests/test_SupportedFileSystems.cc | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/exclude_loopdev_tests.sh b/tests/exclude_loopdev_tests.sh index dc1646da..89d38821 100755 --- a/tests/exclude_loopdev_tests.sh +++ b/tests/exclude_loopdev_tests.sh @@ -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 } diff --git a/tests/test_SupportedFileSystems.cc b/tests/test_SupportedFileSystems.cc index a3c5242a..30fa1c10 100644 --- a/tests/test_SupportedFileSystems.cc +++ b/tests/test_SupportedFileSystems.cc @@ -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& 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