diff --git a/test/Jamfile b/test/Jamfile index 0d494b70..cc0d3ca8 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -54,6 +54,7 @@ rule bpl-test ( name ? : files * ) bpl-test bienstman1 ; bpl-test bienstman2 ; bpl-test bienstman3 ; +bpl-test bienstman4 ; bpl-test try : newtest.py m1.cpp m2.cpp ; bpl-test builtin_converters : test_builtin_converters.py test_builtin_converters.cpp ; bpl-test test_pointer_adoption ; diff --git a/test/bienstman4.cpp b/test/bienstman4.cpp new file mode 100644 index 00000000..76a1c209 --- /dev/null +++ b/test/bienstman4.cpp @@ -0,0 +1,38 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. + +#include +#include +#include +#include + +struct T1 {}; + +struct Term {Term(T1 const&) {} }; + +struct Expression {void add(Term const&) {} }; + +BOOST_PYTHON_MODULE_INIT(bienstman4_ext) +{ + using namespace boost::python; + using boost::mpl::type_list; + + implicitly_convertible(); + + module("bienstman4_ext") + .add(class_("Expression") + .def("add", &Expression::add)) + .add(class_("T1")) + .add(class_("Term") + .def_init(type_list())) + ; + + + T1 t1; + Expression e; + e.add(t1); +} + diff --git a/test/bienstman4.py b/test/bienstman4.py new file mode 100644 index 00000000..2fede1fc --- /dev/null +++ b/test/bienstman4.py @@ -0,0 +1,18 @@ +''' +>>> from bienstman4_ext import * +>>> t1 = T1() +>>> e = Expression() +>>> e.add(t1) +''' +def run(args = None): + import sys + import doctest + + if args is not None: + sys.argv = args + return doctest.testmod(sys.modules.get(__name__)) + +if __name__ == '__main__': + print "running..." + import sys + sys.exit(run()[0])