Test/fixes to handle NULL pointer for unique_ptr/auto_ptr

Also add missing unique_ptr tests for Lua and Racket.
This commit is contained in:
William S Fulton 2022-08-31 08:35:55 +01:00
commit 7934561874
32 changed files with 434 additions and 6 deletions

View file

@ -90,6 +90,11 @@ var checkCount = function(expected_count) {
checkCount(0);
}
cpp11_std_unique_ptr.takeKlassUniquePtr(null);
cpp11_std_unique_ptr.takeKlassUniquePtr(cpp11_std_unique_ptr.make_null());
checkCount(0);
// unique_ptr as output
k1 = cpp11_std_unique_ptr.makeKlassUniquePtr("first");
if (k1.getLabel() !== "first")
@ -110,3 +115,6 @@ if (k2.getLabel() !== "second")
// Above not deleting the C++ object(node v12) - can't reliably control GC
cpp11_std_unique_ptr.takeKlassUniquePtr(k2);
checkCount(0);
if (cpp11_std_unique_ptr.makeNullUniquePtr() != null)
throw new Error("null failure");

View file

@ -90,6 +90,11 @@ var checkCount = function(expected_count) {
checkCount(0);
}
li_std_auto_ptr.takeKlassAutoPtr(null);
li_std_auto_ptr.takeKlassAutoPtr(li_std_auto_ptr.make_null());
checkCount(0);
// auto_ptr as output
k1 = li_std_auto_ptr.makeKlassAutoPtr("first");
if (k1.getLabel() !== "first")
@ -109,4 +114,8 @@ if (k2.getLabel() !== "second")
// delete k2;
// Above not deleting the C++ object(node v12) - can't reliably control GC
li_std_auto_ptr.takeKlassAutoPtr(k2);
if (li_std_auto_ptr.makeNullAutoPtr() != null)
throw new Error("null failure");
checkCount(0);