From 0540a5259c816167eb2f5839aac682067f59207c Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Fri, 19 Apr 2024 12:49:06 -0700 Subject: [PATCH] fix tag in StaticSingletonManager tests Summary: The tag type should be per-type-param, not shared between type-params. Reviewed By: Gownta Differential Revision: D56318056 fbshipit-source-id: c53a79d26e80a1b63f420f8b143dc880b8bd148b --- .../test/StaticSingletonManagerTest.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/folly/detail/test/StaticSingletonManagerTest.cpp b/folly/detail/test/StaticSingletonManagerTest.cpp index 43e8ca8a7d9..cd606cd480a 100644 --- a/folly/detail/test/StaticSingletonManagerTest.cpp +++ b/folly/detail/test/StaticSingletonManagerTest.cpp @@ -48,7 +48,7 @@ template struct StaticSingletonManagerTest : public testing::TestWithParam {}; TYPED_TEST_SUITE_P(StaticSingletonManagerTest); -template +template struct Tag {}; template @@ -59,18 +59,18 @@ TYPED_TEST_P(StaticSingletonManagerTest, example) { using T = std::integral_constant; - auto& i = K::template create>(); + auto& i = K::template create>(); EXPECT_EQ(T::value, i); - auto& j = K::template create>(); + auto& j = K::template create>(); EXPECT_EQ(&i, &j); EXPECT_EQ(T::value, j); - auto& k = K::template create>(); + auto& k = K::template create>(); EXPECT_NE(&i, &k); EXPECT_EQ(T::value, k); - static typename K::template ArgCreate m_arg{tag>}; + static typename K::template ArgCreate m_arg{tag>}; auto& m = K::template create(m_arg); EXPECT_NE(&i, &m); EXPECT_EQ(T::value, m); @@ -86,22 +86,23 @@ INSTANTIATE_TYPED_TEST_SUITE_P( INSTANTIATE_TYPED_TEST_SUITE_P( with_rtti, StaticSingletonManagerTest, StaticSingletonManagerWithRtti); #endif +struct StaticSingletonManagerTestType : StaticSingletonManager {}; INSTANTIATE_TYPED_TEST_SUITE_P( - selection, StaticSingletonManagerTest, StaticSingletonManager); + selection, StaticSingletonManagerTest, StaticSingletonManagerTestType); struct CreateGlobalTest : testing::Test {}; TEST_F(CreateGlobalTest, example) { using T = std::integral_constant; - auto& i = createGlobal>(); + auto& i = createGlobal>(); EXPECT_EQ(T::value, i); - auto& j = createGlobal>(); + auto& j = createGlobal>(); EXPECT_EQ(&i, &j); EXPECT_EQ(T::value, j); - auto& k = createGlobal>(); + auto& k = createGlobal>(); EXPECT_NE(&i, &k); EXPECT_EQ(T::value, k); }