How do I split test case name into 2 lines

25 views Asked by At

I want to split the gtest case name into 2 line as the name exceeds more than 75 character per line.

Consider a sample test case.

TEST_F(ServerCN#3Test,
       ServerCN#3ConnectionCreateReturnErrorNo87WhenInvalidconnectionConnectionParameterPassed) {
    char * ip = xx.xx.xx.xx;
        int port = 1111
    error = class::ConnectionCreate(ip,port);
    EXPECT_EQ(error, 87);
}

Is it possible to make it to 75 character per line, like this

TEST_F(ServerCN#3Test,
       ServerCN#3ConnectionCreateReturnErrorNo87When
       InvalidconnectionConnectionParameterPassed) {
    char * ip = xx.xx.xx.xx;
        int port = 1111
    error = class::ConnectionCreate(ip,port);
    EXPECT_EQ(error, 87);
}
1

There are 1 answers

0
463035818_is_not_an_ai On

You are already in macro-world, so you can use one more to concatenate two parts of the name:

#define TEST_F(NAME) HELLO WORLD NAME
#define LONG_NAME(A,B) A##B

TEST_F(LONG_NAME(Foo,
          Bar))

expands to:

HELLO WORLD FooBar