[pygccxml-commit] SF.net SVN: pygccxml: [1116] pyplusplus_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2007-09-20 18:57:59
|
Revision: 1116
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1116&view=rev
Author: roman_yakovenko
Date: 2007-09-20 11:57:59 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
fixing "already_exposed" functionality - improving unit tests
Modified Paths:
--------------
pyplusplus_dev/unittests/data/enums_to_be_exported.hpp
pyplusplus_dev/unittests/enums_tester.py
pyplusplus_dev/unittests/fundamental_tester_base.py
Modified: pyplusplus_dev/unittests/data/enums_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/enums_to_be_exported.hpp 2007-09-20 18:44:54 UTC (rev 1115)
+++ pyplusplus_dev/unittests/data/enums_to_be_exported.hpp 2007-09-20 18:57:59 UTC (rev 1116)
@@ -1,26 +1,28 @@
-// 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 __enums_to_be_exported_hpp__
-#define __enums_to_be_exported_hpp__
-
-namespace enums{
-
-enum color{
- red = 1
- , green = 2
- , blue = 4 };
+// 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 __enums_to_be_exported_hpp__
+#define __enums_to_be_exported_hpp__
+
+enum Chisla{ nol, odin, dva, tri };
+
+namespace enums{
+
+enum color{
+ red = 1
+ , green = 2
+ , blue = 4 };
+
enum numbers{
zero = 0
, noll = 0
};
-
-inline int to_int( int x=red ){ return x; }
-
-}
-
-
-#endif//__enums_to_be_exported_hpp__
+
+inline int to_int( int x=red ){ return x; }
+
+}
+
+
+#endif//__enums_to_be_exported_hpp__
Modified: pyplusplus_dev/unittests/enums_tester.py
===================================================================
--- pyplusplus_dev/unittests/enums_tester.py 2007-09-20 18:44:54 UTC (rev 1115)
+++ pyplusplus_dev/unittests/enums_tester.py 2007-09-20 18:57:59 UTC (rev 1116)
@@ -18,6 +18,8 @@
, *args )
def customize(self, mb ):
+ mb.enum( 'Chisla' ).include()
+
color = mb.enumeration( 'color' )
color.alias = 'Color'
color.value_aliases['red'] = 'RED'
@@ -45,4 +47,4 @@
unittest.TextTestRunner(verbosity=2).run( create_suite() )
if __name__ == "__main__":
- run_suite()
\ No newline at end of file
+ run_suite()
Modified: pyplusplus_dev/unittests/fundamental_tester_base.py
===================================================================
--- pyplusplus_dev/unittests/fundamental_tester_base.py 2007-09-20 18:44:54 UTC (rev 1115)
+++ pyplusplus_dev/unittests/fundamental_tester_base.py 2007-09-20 18:57:59 UTC (rev 1116)
@@ -8,6 +8,8 @@
import unittest
import autoconfig
from pygccxml import parser
+from pyplusplus import utils
+from pygccxml import declarations
from pyplusplus import module_builder
LICENSE = """// Copyright 2004 Roman Yakovenko.
@@ -46,6 +48,21 @@
was_exception = True
self.failUnless(was_exception, 'exception has not been raised during execution.')
+ def __test_already_exposed( self, mb ):
+ exposed_db = utils.exposed_decls_db_t()
+ exposed_db.load( autoconfig.build_dir )
+ irrelevant_decl_types = ( declarations.typedef_t
+ , declarations.namespace_t
+ , declarations.free_operator_t )
+ for d in mb.decls():
+ if d.ignore or not d.exportable or isinstance( d, irrelevant_decl_types ):
+ continue
+ if d.parent and not d.parent.name:
+ continue #unnamed classes
+ self.failUnless( exposed_db.is_exposed( d )
+ , '''Declaration "%s" is exposed, but for some reason it isn't marked as such.'''
+ % str( d ) )
+
def customize(self, generator):
pass
@@ -86,6 +103,7 @@
mb.code_creator.precompiled_header = "boost/python.hpp"
mb.code_creator.license = LICENSE
self.generate_source_files( mb )
+ self.__test_already_exposed( mb )
def _create_sconstruct(self, sources ):
sources_str = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|