From 9da95dba4d0b3315ae9a4db817459699787d02d4 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 18 Nov 2014 04:39:31 -0800 Subject: [PATCH] C++11: limit unit-tests using C++11 features to only build when able --- src/tests/testHttp1Parser.cc | 5 +++++ src/tests/testHttp1Parser.h | 5 +++++ 2 files changed, 10 insertions(+) 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 -- 2.47.2