From 623cef92a8dc7edc1035b42de4d15aaeac346a76 Mon Sep 17 00:00:00 2001 From: Neargye Date: Fri, 4 May 2018 00:50:08 +0500 Subject: [PATCH] add new test case --- test/test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test.cpp b/test/test.cpp index c8b36e3..3988c03 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -202,3 +202,21 @@ TEST_CASE("NAMEOF_FULL") { REQUIRE(std::strcmp(NAMEOF_FULL(__FILE__), "__FILE__") == 0); } } + +TEST_CASE("Spaces are ignored") { + // variable + REQUIRE(std::strcmp(NAMEOF( (&somevar)->somefield ), "somefield") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL( (&somevar)->somefield ), "(&somevar)->somefield") == 0); + // type + REQUIRE(std::strcmp(NAMEOF( std::string ), "string") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL( std::string ), "std::string") == 0); + // function + REQUIRE(std::strcmp(NAMEOF( &SomeStruct::SomeMethod2 ), "SomeMethod2") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL( &SomeStruct::SomeMethod2 ), "&SomeStruct::SomeMethod2") == 0); + // enum + REQUIRE(std::strcmp(NAMEOF( Color::RED ), "RED") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL( Color::RED ), "Color::RED") == 0); + // macros + REQUIRE(std::strcmp(NAMEOF( __cplusplus ), "__cplusplus") == 0); + REQUIRE(std::strcmp(NAMEOF_FULL( __cplusplus ), "__cplusplus") == 0); +}