From: Amos Jeffries Date: Tue, 18 Nov 2014 12:39:31 +0000 (-0800) Subject: C++11: limit unit-tests using C++11 features to only build when able X-Git-Tag: merge-candidate-3-v1~487 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9da95dba4d0b3315ae9a4db817459699787d02d4;p=thirdparty%2Fsquid.git C++11: limit unit-tests using C++11 features to only build when able --- diff --git a/src/tests/testHttp1Parser.cc b/src/tests/testHttp1Parser.cc index 716e728a67..a3f01eb860 100644 --- a/src/tests/testHttp1Parser.cc +++ b/src/tests/testHttp1Parser.cc @@ -39,6 +39,8 @@ testHttp1Parser::globalSetup() Config.maxRequestHeaderSize = 1024; // XXX: unit test the RequestParser handling of this limit } +#if __cplusplus >= 201103L + struct resultSet { bool parsed; bool needsMore; @@ -84,6 +86,7 @@ testResults(int line, const SBuf &input, Http1::RequestParser &output, struct re CPPUNIT_ASSERT_EQUAL(expect.versionEnd, output.req.v_end); CPPUNIT_ASSERT_EQUAL(expect.version, output.msgProtocol_); } +#endif /* __cplusplus >= 200103L */ void testHttp1Parser::testParserConstruct() @@ -130,6 +133,7 @@ testHttp1Parser::testParserConstruct() } } +#if __cplusplus >= 201103L void testHttp1Parser::testParseRequestLineProtocols() { @@ -1445,3 +1449,4 @@ testHttp1Parser::testDripFeed() break; } } +#endif /* __cplusplus >= 201103L */ diff --git a/src/tests/testHttp1Parser.h b/src/tests/testHttp1Parser.h index f844827231..02a3174c7f 100644 --- a/src/tests/testHttp1Parser.h +++ b/src/tests/testHttp1Parser.h @@ -15,12 +15,15 @@ class testHttp1Parser : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( testHttp1Parser ); CPPUNIT_TEST( testParserConstruct ); + +#if __cplusplus >= 201103L CPPUNIT_TEST( testParseRequestLineTerminators ); CPPUNIT_TEST( testParseRequestLineMethods ); CPPUNIT_TEST( testParseRequestLineProtocols ); CPPUNIT_TEST( testParseRequestLineStrange ); CPPUNIT_TEST( testParseRequestLineInvalid ); CPPUNIT_TEST( testDripFeed ); +#endif CPPUNIT_TEST_SUITE_END(); protected: @@ -28,6 +31,7 @@ protected: void testParserConstruct(); // whether the constructor works +#if __cplusplus >= 201103L // request-line unit tests void testParseRequestLineTerminators(); // terminator detection correct void testParseRequestLineMethods(); // methoid detection correct @@ -36,6 +40,7 @@ protected: void testParseRequestLineInvalid(); // rejection of invalid lines happens void testDripFeed(); // test incremental parse works +#endif }; #endif