add test case "Spaces and Tabs ignored"

This commit is contained in:
Neargye 2018-05-04 01:10:17 +05:00
parent 623cef92a8
commit f746b5c69e

View file

@ -203,7 +203,8 @@ TEST_CASE("NAMEOF_FULL") {
} }
} }
TEST_CASE("Spaces are ignored") { TEST_CASE("Spaces and Tabs are ignored") {
SECTION("Spaces") {
// variable // variable
REQUIRE(std::strcmp(NAMEOF( (&somevar)->somefield ), "somefield") == 0); REQUIRE(std::strcmp(NAMEOF( (&somevar)->somefield ), "somefield") == 0);
REQUIRE(std::strcmp(NAMEOF_FULL( (&somevar)->somefield ), "(&somevar)->somefield") == 0); REQUIRE(std::strcmp(NAMEOF_FULL( (&somevar)->somefield ), "(&somevar)->somefield") == 0);
@ -219,4 +220,22 @@ TEST_CASE("Spaces are ignored") {
// macros // macros
REQUIRE(std::strcmp(NAMEOF( __cplusplus ), "__cplusplus") == 0); REQUIRE(std::strcmp(NAMEOF( __cplusplus ), "__cplusplus") == 0);
REQUIRE(std::strcmp(NAMEOF_FULL( __cplusplus ), "__cplusplus") == 0); REQUIRE(std::strcmp(NAMEOF_FULL( __cplusplus ), "__cplusplus") == 0);
}
SECTION("Tabs") {
// 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);
}
} }