[pygccxml-commit] SF.net SVN: pygccxml:[1816] pygccxml_dev/unittests
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2010-01-26 19:40:24
|
Revision: 1816 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1816&view=rev Author: roman_yakovenko Date: 2010-01-26 19:40:18 +0000 (Tue, 26 Jan 2010) Log Message: ----------- add tester for gccxml 10185 issue Modified Paths: -------------- pygccxml_dev/unittests/test_all.py pygccxml_dev/unittests/type_as_exception_bug_tester.py Added Paths: ----------- pygccxml_dev/unittests/gccxml10185_tester.py Added: pygccxml_dev/unittests/gccxml10185_tester.py =================================================================== --- pygccxml_dev/unittests/gccxml10185_tester.py (rev 0) +++ pygccxml_dev/unittests/gccxml10185_tester.py 2010-01-26 19:40:18 UTC (rev 1816) @@ -0,0 +1,42 @@ +# Copyright 2004-2008 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 unittest +import autoconfig +import parser_test_case + +from pygccxml import utils +from pygccxml import parser +from pygccxml import declarations + +code = \ +""" +template <typename T> struct A {}; +template <int N> struct A<const char[N]> +{ static int size(const char[N]) { return N - 1; } }; +""" + +class tester_t( parser_test_case.parser_test_case_t ): + def __init__(self, *args): + parser_test_case.parser_test_case_t.__init__(self, *args) + + def test(self): + src_reader = parser.source_reader_t( self.config ) + global_ns = declarations.get_global_namespace( src_reader.read_string( code ) ) + a = global_ns.class_( 'A<const char [N]>' ) + size = a.mem_fun( 'size' ) + + +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: pygccxml_dev/unittests/test_all.py =================================================================== --- pygccxml_dev/unittests/test_all.py 2010-01-26 19:36:54 UTC (rev 1815) +++ pygccxml_dev/unittests/test_all.py 2010-01-26 19:40:18 UTC (rev 1816) @@ -55,6 +55,7 @@ import calling_convention_tester import const_volatile_arg_tester import array_bug_tester +import gccxml10185_tester testers = [ decl_string_tester @@ -106,6 +107,7 @@ , calling_convention_tester , const_volatile_arg_tester , array_bug_tester + , gccxml10185_tester ] def create_suite(): Modified: pygccxml_dev/unittests/type_as_exception_bug_tester.py =================================================================== --- pygccxml_dev/unittests/type_as_exception_bug_tester.py 2010-01-26 19:36:54 UTC (rev 1815) +++ pygccxml_dev/unittests/type_as_exception_bug_tester.py 2010-01-26 19:40:18 UTC (rev 1816) @@ -24,14 +24,13 @@ tester_t.global_ns.init_optimizer() def test( self ): - pass - #~ buggy = self.global_ns.mem_fun( 'buggy' ) - #~ ExpressionError = self.global_ns.class_( 'ExpressionError' ) - #~ self.failUnless( len( buggy.exceptions ) == 1 ) - #~ err = buggy.exceptions[0] - #~ self.failUnless( declarations.is_reference( err ) ) - #~ err = declarations.remove_declarated( declarations.remove_reference( err ) ) - #~ self.failUnless( err is ExpressionError ) + buggy = self.global_ns.mem_fun( 'buggy' ) + ExpressionError = self.global_ns.class_( 'ExpressionError' ) + self.failUnless( len( buggy.exceptions ) == 1 ) + err = buggy.exceptions[0] + self.failUnless( declarations.is_reference( err ) ) + err = declarations.remove_declarated( declarations.remove_reference( err ) ) + self.failUnless( err is ExpressionError ) def create_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |