From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:28:50 +0000 (+0000) Subject: Maintenance: consolidate testBoilerpate header file (#1534) X-Git-Tag: SQUID_7_0_1~319 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8168ee3460f9b1c6cfe837492a00be6e1e20b07d;p=thirdparty%2Fsquid.git Maintenance: consolidate testBoilerpate header file (#1534) --- diff --git a/src/Makefile.am b/src/Makefile.am index d9857b6762..8058f77608 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -747,8 +747,7 @@ TESTSOURCES= \ ## involved in writing tests. check_PROGRAMS += tests/testBoilerplate tests_testBoilerplate_SOURCES = \ - tests/testBoilerplate.cc \ - tests/testBoilerplate.h + tests/testBoilerplate.cc nodist_tests_testBoilerplate_SOURCES = \ $(TESTSOURCES) tests_testBoilerplate_LDADD= \ diff --git a/src/tests/testBoilerplate.cc b/src/tests/testBoilerplate.cc index 25449411e4..a3c2efb15d 100644 --- a/src/tests/testBoilerplate.cc +++ b/src/tests/testBoilerplate.cc @@ -7,11 +7,29 @@ */ #include "squid.h" -#include "testBoilerplate.h" +#include "compat/cppunit.h" #include "unitTestMain.h" #include +/* + * This is a rough example of a typical unit test file. + * + * If the class declaration is used in more than one source file, + * then place that declaration into a dedicated header file instead. + */ + +class TestBoilerplate: public CPPUNIT_NS::TestFixture +{ + CPPUNIT_TEST_SUITE( TestBoilerplate ); + /* note the statement here and then the actual prototype below */ + CPPUNIT_TEST( testDemonstration ); + CPPUNIT_TEST_SUITE_END(); + +protected: + void testDemonstration(); +}; + CPPUNIT_TEST_SUITE_REGISTRATION( TestBoilerplate ); void diff --git a/src/tests/testBoilerplate.h b/src/tests/testBoilerplate.h deleted file mode 100644 index e387f37cdc..0000000000 --- a/src/tests/testBoilerplate.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 1996-2023 The Squid Software Foundation and contributors - * - * Squid software is distributed under GPLv2+ license and includes - * contributions from numerous individuals and organizations. - * Please see the COPYING and CONTRIBUTORS files for details. - */ - -#ifndef SQUID_SRC_TEST_BOILDERPLATE_H -#define SQUID_SRC_TEST_BOILDERPLATE_H - -#include "compat/cppunit.h" - -/* - * demonstration test file, as new idioms are made they will - * be shown in the TestBoilerplate source. - * - * If a class declaration is only used in one source file, then declare - * that class where it is used instead of adding a dedicated header file. - */ - -class TestBoilerplate: public CPPUNIT_NS::TestFixture -{ - CPPUNIT_TEST_SUITE( TestBoilerplate ); - /* note the statement here and then the actual prototype below */ - CPPUNIT_TEST( testDemonstration ); - CPPUNIT_TEST_SUITE_END(); - -public: - -protected: - void testDemonstration(); -}; - -#endif /* SQUID_SRC_TEST_BOILDERPLATE_H */ -