From b9a925dbd4c32af3e04e603e0d7692ab976be2d8 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 6 Apr 2021 10:43:51 +0200 Subject: [PATCH] test: avoid regressions with any and deduced const T[N] types --- test/entt/core/any.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/entt/core/any.cpp b/test/entt/core/any.cpp index 41d665b49..696d6b819 100644 --- a/test/entt/core/any.cpp +++ b/test/entt/core/any.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -966,3 +967,17 @@ TEST_F(Any, AggregatesMustWork) { // the goal of this test is to enforce the requirements for aggregate types entt::any{std::in_place_type, 42}.emplace(42); } + +TEST_F(Any, DeducedArrayType) { + entt::any any{"array of char"}; + + ASSERT_TRUE(any); + ASSERT_EQ(any.type(), entt::type_id()); + ASSERT_EQ((std::strcmp("array of char", entt::any_cast(any))), 0); + + any = "another array of char"; + + ASSERT_TRUE(any); + ASSERT_EQ(any.type(), entt::type_id()); + ASSERT_EQ((std::strcmp("another array of char", entt::any_cast(any))), 0); +}