[pygccxml-commit] SF.net SVN: pygccxml: [1199] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2007-12-05 20:52:47
|
Revision: 1199
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1199&view=rev
Author: roman_yakovenko
Date: 2007-12-05 12:52:52 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
adding new tester for precompiled header files
Modified Paths:
--------------
pyplusplus_dev/unittests/test_all.py
Added Paths:
-----------
pyplusplus_dev/unittests/data/precompiled_header_to_be_exported.hpp
pyplusplus_dev/unittests/precompiled_header_tester.py
Added: pyplusplus_dev/unittests/data/precompiled_header_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/precompiled_header_to_be_exported.hpp (rev 0)
+++ pyplusplus_dev/unittests/data/precompiled_header_to_be_exported.hpp 2007-12-05 20:52:52 UTC (rev 1199)
@@ -0,0 +1,18 @@
+// Copyright 2004 Roman Yakovenko.
+// 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)
+
+#ifndef __precompiled_header_to_be_exported_hpp__
+#define __precompiled_header_to_be_exported_hpp__
+
+namespace enums{
+
+enum color{ red, green, blue};
+
+inline int to_int( int x=red ){ return x; }
+
+}
+
+
+#endif//__precompiled_header_to_be_exported_hpp__
Added: pyplusplus_dev/unittests/precompiled_header_tester.py
===================================================================
--- pyplusplus_dev/unittests/precompiled_header_tester.py (rev 0)
+++ pyplusplus_dev/unittests/precompiled_header_tester.py 2007-12-05 20:52:52 UTC (rev 1199)
@@ -0,0 +1,47 @@
+# Copyright 2004 Roman Yakovenko.
+# 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 os
+import sys
+import unittest
+import autoconfig
+import fundamental_tester_base
+from pyplusplus import code_creators
+
+class tester_t(fundamental_tester_base.fundamental_tester_base_t):
+ EXTENSION_NAME = 'precompiled_header'
+
+ def __init__( self, *args ):
+ fundamental_tester_base.fundamental_tester_base_t.__init__(
+ self
+ , tester_t.EXTENSION_NAME
+ , *args )
+
+ def customize(self, mb ):
+ #add precompiled header
+ mb.build_code_creator( self.EXTENSION_NAME )
+ stdafx = code_creators.include_t( 'stdafx.h' )
+ mb.code_creator.adopt_creator( stdafx, 0 )
+
+ f = file( os.path.join( autoconfig.build_dir, 'stdafx.h' ), 'w+' )
+ f.writelines( ['//this should be the first header file' + os.linesep] )
+ f.close()
+
+ def run_tests(self, module):
+ lines = file( os.path.join( autoconfig.build_dir, 'precompiled_header.cpp' ) ).readlines()
+ lines = filter( lambda l: l.startswith( '#include' ), lines )
+ self.failUnless( '#include "stdafx.h"' in lines[0] )
+
+
+def create_suite():
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite(tester_t))
+ return suite
+
+def run_suite():
+ unittest.TextTestRunner(verbosity=2).run( create_suite() )
+
+if __name__ == "__main__":
+ run_suite()
Modified: pyplusplus_dev/unittests/test_all.py
===================================================================
--- pyplusplus_dev/unittests/test_all.py 2007-12-05 14:49:45 UTC (rev 1198)
+++ pyplusplus_dev/unittests/test_all.py 2007-12-05 20:52:52 UTC (rev 1199)
@@ -96,9 +96,9 @@
import include_exclude_bug_tester
import vector_with_shared_data_tester
import constructors_bug_tester
+import precompiled_header_tester
-
testers = [
algorithms_tester
, module_body_tester
@@ -181,6 +181,7 @@
, vector_with_shared_data_tester
, templates_tester
, constructors_bug_tester
+ , precompiled_header_tester
]
class module_runner_t( object ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|