]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
C++11: limit unit-tests using C++11 features to only build when able
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 18 Nov 2014 12:39:31 +0000 (04:39 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 18 Nov 2014 12:39:31 +0000 (04:39 -0800)
src/tests/testHttp1Parser.cc
src/tests/testHttp1Parser.h

index 716e728a670d605bef899f1268341701d4dfaa16..a3f01eb860f80a9e497793f753c7352c80bf2989 100644 (file)
@@ -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 */
index f8448272317de14e6b1aae4147cc1c9e477bd1b2..02a3174c7f9b1237b50856f9363f67417718cbcd 100644 (file)
@@ -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