Added tests for headers being self-contained (i.e. no missing includes).

This commit is contained in:
Andrey Semashev
2018-10-28 20:10:39 +03:00
committed by Peter Dimov
parent a080dd98a5
commit e7371191f7
2 changed files with 46 additions and 8 deletions
+24 -8
View File
@@ -3,21 +3,37 @@
# (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import testing ;
import path ;
import regex ;
rule test_all
{
local all_rules = ;
local all_rules ;
local file ;
local headers_path = [ path.make $(BOOST_ROOT)/libs/heap/include/boost/heap ] ;
for file in [ path.glob-tree $(headers_path) : *.hpp : detail ]
{
local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
# Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
# All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
local test_name = [ regex.replace ~hdr/$(rel_file) "/" "-" ] ;
#ECHO $(rel_file) ;
all_rules += [ compile self_contained_header.cpp : <define>"BOOST_HEAP_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(test_name) ] ;
}
for local fileb in [ glob *.cpp ]
for file in [ glob *.cpp ]
{
all_rules += [ run $(fileb)
: # additional args
: # test-files
: <library>/boost/test//boost_unit_test_framework # requirements
] ;
if [ path.basename $(file) ] != "self_contained_header.cpp"
{
all_rules += [ run $(file)
: # additional args
: # test-files
: <library>/boost/test//boost_unit_test_framework # requirements
] ;
}
}
return $(all_rules) ;
}
test-suite heap : [ test_all r ] : <threading>multi ;
test-suite heap : [ test_all ] : <threading>multi ;
+22
View File
@@ -0,0 +1,22 @@
/*
* Copyright Andrey Semashev 2018.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file self_contained_header.cpp
* \author Andrey Semashev
* \date 28.10.2018
*
* \brief This file contains a test boilerplate for checking that every public header is self-contained and does not have any missing #includes.
*/
#define BOOST_HEAP_TEST_INCLUDE_HEADER() <boost/heap/BOOST_HEAP_TEST_HEADER>
#include BOOST_HEAP_TEST_INCLUDE_HEADER()
int main(int, char*[])
{
return 0;
}