diff --git a/Examples/test-suite/li_boost_shared_ptr.i b/Examples/test-suite/li_boost_shared_ptr.i index b64197be1..001eacb78 100644 --- a/Examples/test-suite/li_boost_shared_ptr.i +++ b/Examples/test-suite/li_boost_shared_ptr.i @@ -242,6 +242,10 @@ std::string nullsmartpointerpointertest(SwigBoost::shared_ptr* k) { else return "also not null"; } + +SwigBoost::shared_ptr* sp_pointer_null() { return NULL; } +SwigBoost::shared_ptr* null_sp_pointer() { static SwigBoost::shared_ptr static_sp; return &static_sp; } +SwigBoost::shared_ptr sp_value_null() { return SwigBoost::shared_ptr(); } // $owner Klass *pointerownertest() { return new Klass("pointerownertest"); diff --git a/Examples/test-suite/python/li_boost_shared_ptr_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_runme.py index 2e241d590..bde79fd61 100644 --- a/Examples/test-suite/python/li_boost_shared_ptr_runme.py +++ b/Examples/test-suite/python/li_boost_shared_ptr_runme.py @@ -168,6 +168,19 @@ class li_boost_shared_ptr_runme: except ValueError: pass + # test null pointers emitted from C++ + k = li_boost_shared_ptr.sp_pointer_null() + if (li_boost_shared_ptr.smartpointertest(k) != None): + raise RuntimeError("return was not null") + + k = li_boost_shared_ptr.null_sp_pointer() + if (li_boost_shared_ptr.smartpointertest(k) != None): + raise RuntimeError("return was not null") + + k = li_boost_shared_ptr.sp_value_null() + if (li_boost_shared_ptr.smartpointertest(k) != None): + raise RuntimeError("return was not null") + # $owner k = li_boost_shared_ptr.pointerownertest() val = k.getValue()