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

@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 28;
use Test::More tests => 30;
BEGIN { use_ok('cpp11_std_unique_ptr') }
require_ok('cpp11_std_unique_ptr');
@ -73,6 +73,11 @@ sub checkCount {
checkCount(0);
}
cpp11_std_unique_ptr::takeKlassUniquePtr(undef);
cpp11_std_unique_ptr::takeKlassUniquePtr(cpp11_std_unique_ptr::make_null());
checkCount(0);
# unique_ptr as output
my $k1 = cpp11_std_unique_ptr::makeKlassUniquePtr("first");
my $k2 = cpp11_std_unique_ptr::makeKlassUniquePtr("second");
@ -85,3 +90,5 @@ is($k2->getLabel, "second", "proper label");
undef $k2;
checkCount(0);
is(cpp11_std_unique_ptr::makeNullUniquePtr(), undef);