Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52929 - trunk/libs/spirit/test/test_headers
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-11 19:56:18


Author: hkaiser
Date: 2009-05-11 19:56:17 EDT (Mon, 11 May 2009)
New Revision: 52929
URL: http://svn.boost.org/trac/boost/changeset/52929

Log:
Spirit: added tests ensuring all headers are self contained
Added:
   trunk/libs/spirit/test/test_headers/
   trunk/libs/spirit/test/test_headers/Jamfile (contents, props changed)
   trunk/libs/spirit/test/test_headers/main.cpp (contents, props changed)
   trunk/libs/spirit/test/test_headers/test.cpp (contents, props changed)

Added: trunk/libs/spirit/test/test_headers/Jamfile
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/test/test_headers/Jamfile 2009-05-11 19:56:17 EDT (Mon, 11 May 2009)
@@ -0,0 +1,77 @@
+# Jamfile
+#
+# Copyright (c) 2007-2008 Steven Watanabe
+# Copyright (c) 2009 Joel de Guzman
+# Copyright (c) 2009 Hartmut Kaiser
+# Copyright (c) 2009 Francois Barel
+#
+# 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
+
+import testing ;
+import path ;
+import regex ;
+import print ;
+import sequence ;
+import feature ;
+
+project boost/spirit/test/test_headers
+ : requirements
+ <include>$(BOOST_ROOT)
+ <include>../../../..
+ <toolset>gcc:<cxxflags>-ftemplate-depth-300
+ <toolset>darwin:<cxxflags>-ftemplate-depth-300
+ ;
+
+headers =
+[
+ path.glob-tree ../../../../boost/spirit/include : *.hpp : classic* phoenix1*
+] ;
+
+for local file in $(headers)
+{
+ compile test.cpp
+ : # requirements
+ <define>BOOST_SPIRIT_HEADER_NAME=$(file)
+ <dependency>$(file)
+ : # test name
+ [ regex.replace [ path.relative-to ../../../.. $(file) ] "/" "_" ]
+ ;
+}
+
+feature.feature <generate-include-all-order> : forward reverse : incidental ;
+
+rule generate-include-all ( target : sources * : properties * )
+{
+ print.output $(target) ;
+
+ if <generate-include-all-order>reverse in $(properties)
+ {
+ sources = [ sequence.reverse $(sources) ] ;
+ }
+
+ for local file in $(sources)
+ {
+ print.text "#include <$(file:G=)>
+" : overwrite ;
+ }
+
+}
+
+make include_all1.cpp
+ : $(headers)
+ : @generate-include-all
+ ;
+
+make include_all2.cpp
+ : $(headers)
+ : @generate-include-all
+ : <generate-include-all-order>reverse
+ ;
+
+# this ought to catch non-inlined functions and other duplicate definitions
+link include_all1.cpp include_all2.cpp main.cpp
+ : <include>.
+ : include_all_headers
+ ;

Added: trunk/libs/spirit/test/test_headers/main.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/test/test_headers/main.cpp 2009-05-11 19:56:17 EDT (Mon, 11 May 2009)
@@ -0,0 +1,14 @@
+// Copyright (c) 2003-2008 Matthias Christian Schabel
+// Copyright (c) 2007-2008 Steven Watanabe
+// Copyright (c) 2009 Joel de Guzman
+// Copyright (c) 2009 Hartmut Kaiser
+// Copyright (c) 2009 Francois Barel
+//
+// 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)
+
+int main()
+{
+ return 0;
+}

Added: trunk/libs/spirit/test/test_headers/test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/test/test_headers/test.cpp 2009-05-11 19:56:17 EDT (Mon, 11 May 2009)
@@ -0,0 +1,22 @@
+// Copyright (c) 2003-2008 Matthias Christian Schabel
+// Copyright (c) 2007-2008 Steven Watanabe
+// Copyright (c) 2009 Joel de Guzman
+// Copyright (c) 2009 Hartmut Kaiser
+// Copyright (c) 2009 Francois Barel
+//
+// 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)
+
+#define BOOST_SPIRIT_STRINGIZE_IMPL(x) #x
+#define BOOST_SPIRIT_STRINGIZE(x) BOOST_SPIRIT_STRINGIZE_IMPL(x)
+
+#define BOOST_SPIRIT_HEADER BOOST_SPIRIT_STRINGIZE(BOOST_SPIRIT_HEADER_NAME)
+
+#include BOOST_SPIRIT_HEADER
+#include BOOST_SPIRIT_HEADER
+
+int main()
+{
+ return 0;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk