[pygccxml-commit] SF.net SVN: pygccxml:[1738] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2009-06-10 06:32:34
|
Revision: 1738
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1738&view=rev
Author: roman_yakovenko
Date: 2009-06-10 06:31:44 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
adding problematic use case, contributed by Zbigniew Mandziejewicz
Modified Paths:
--------------
pygccxml_dev/pygccxml/declarations/decl_printer.py
pygccxml_dev/unittests/project_reader_correctness_tester.py
Added Paths:
-----------
pygccxml_dev/unittests/data/separate_compilation/
pygccxml_dev/unittests/data/separate_compilation/all.h
pygccxml_dev/unittests/data/separate_compilation/base.h
pygccxml_dev/unittests/data/separate_compilation/data.h
pygccxml_dev/unittests/data/separate_compilation/derived.h
Modified: pygccxml_dev/pygccxml/declarations/decl_printer.py
===================================================================
--- pygccxml_dev/pygccxml/declarations/decl_printer.py 2009-05-19 17:44:52 UTC (rev 1737)
+++ pygccxml_dev/pygccxml/declarations/decl_printer.py 2009-06-10 06:31:44 UTC (rev 1738)
@@ -29,7 +29,7 @@
self.__verbose = verbose
self.__writer = writer
if not self.__writer:
- self.__writer = lambda x: sys.stdout.write( x + os.linesep )
+ self.__writer = lambda x: sys.stdout.write( x )
def clone(self, increment_level=True):
level = self.__level
Added: pygccxml_dev/unittests/data/separate_compilation/all.h
===================================================================
--- pygccxml_dev/unittests/data/separate_compilation/all.h (rev 0)
+++ pygccxml_dev/unittests/data/separate_compilation/all.h 2009-06-10 06:31:44 UTC (rev 1738)
@@ -0,0 +1,8 @@
+#ifndef __all_h_10062009__
+#define __all_h_10062009__ 1
+
+#include "data.h"
+#include "base.h"
+#include "derived.h"
+
+#endif//__all_h_10062009__
Added: pygccxml_dev/unittests/data/separate_compilation/base.h
===================================================================
--- pygccxml_dev/unittests/data/separate_compilation/base.h (rev 0)
+++ pygccxml_dev/unittests/data/separate_compilation/base.h 2009-06-10 06:31:44 UTC (rev 1738)
@@ -0,0 +1,15 @@
+#ifndef __base_h_10062009__
+#define __base_h_10062009__ 1
+
+#include "data.h"
+
+namespace buggy{
+
+struct base_t{
+ virtual ~base_t() {};
+ virtual data_t* get_data() const = 0;
+};
+
+}
+
+#endif//__base_h_10062009__
Added: pygccxml_dev/unittests/data/separate_compilation/data.h
===================================================================
--- pygccxml_dev/unittests/data/separate_compilation/data.h (rev 0)
+++ pygccxml_dev/unittests/data/separate_compilation/data.h 2009-06-10 06:31:44 UTC (rev 1738)
@@ -0,0 +1,32 @@
+#ifndef __data_h_10062009__
+#define __data_h_10062009__ 1
+
+namespace std{
+
+template<class T1, class T2>
+struct pair{
+ typedef pair<T1, T2> _Myt;
+ typedef T1 first_type;
+ typedef T2 second_type;
+
+ pair(): first(T1()), second(T2())
+ {}
+
+ pair(const T1& t1, const T2& t2)
+ : first(t1), second(t2)
+ {}
+
+ T1 first; // the first stored value
+ T2 second; // the second stored value
+};
+}
+
+namespace buggy{
+
+struct data_t{
+ typedef std::pair<data_t*, data_t*> pair_t;
+};
+
+}
+
+#endif//__data_h_10062009__
Added: pygccxml_dev/unittests/data/separate_compilation/derived.h
===================================================================
--- pygccxml_dev/unittests/data/separate_compilation/derived.h (rev 0)
+++ pygccxml_dev/unittests/data/separate_compilation/derived.h 2009-06-10 06:31:44 UTC (rev 1738)
@@ -0,0 +1,20 @@
+#ifndef __derived_h_10062009__
+#define __derived_h_10062009__ 1
+
+#include "base.h"
+
+namespace buggy{
+
+class derived_t: public base_t{
+public:
+
+ virtual ~derived_t() {};
+ virtual data_t* get_data() const;
+
+private:
+ data_t::pair_t data_pair;
+};
+
+}
+
+#endif//__derived_h_10062009__
Modified: pygccxml_dev/unittests/project_reader_correctness_tester.py
===================================================================
--- pygccxml_dev/unittests/project_reader_correctness_tester.py 2009-05-19 17:44:52 UTC (rev 1737)
+++ pygccxml_dev/unittests/project_reader_correctness_tester.py 2009-06-10 06:31:44 UTC (rev 1738)
@@ -10,7 +10,7 @@
import pygccxml
from pygccxml import utils
from pygccxml import parser
-from pygccxml import declarations
+from pygccxml import declarations
class tester_t( parser_test_case.parser_test_case_t ):
def __init__(self, *args):
@@ -50,10 +50,39 @@
def test_correctness(self):
for src in self.__files:
self.__test_correctness_impl( src )
-
+
+
+class tester2_t( parser_test_case.parser_test_case_t ):
+ def __init__(self, *args):
+ parser_test_case.parser_test_case_t.__init__(self, *args)
+ self.__files = [
+ 'separate_compilation/data.h'
+ , 'separate_compilation/base.h'
+ , 'separate_compilation/derived.h'
+ ]
+
+ def test(self):
+ prj_reader = parser.project_reader_t( self.config )
+ prj_decls = prj_reader.read_files( self.__files
+ , compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE )
+ src_reader = parser.source_reader_t( self.config )
+ src_decls = src_reader.read_file( 'separate_compilation/all.h' )
+ if src_decls != prj_decls:
+ s = src_decls[0]
+ p = prj_decls[0]
+ sr = file( os.path.join( autoconfig.build_directory , 'separate_compilation.sr.txt'),'w+b' )
+ pr = file( os.path.join( autoconfig.build_directory , 'separate_compilation.pr.txt'), 'w+b' )
+ declarations.print_declarations( s, writer=lambda l: sr.write( l ) )
+ declarations.print_declarations( p, writer=lambda l: pr.write( l ) )
+ sr.close()
+ pr.close()
+ self.fail( "Expected - There is a difference between declarations" )
+
+
def create_suite():
- suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite(tester_t))
+ suite = unittest.TestSuite()
+ suite.addTest( unittest.makeSuite(tester_t))
+ suite.addTest( unittest.makeSuite(tester2_t))
return suite
def run_suite():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|