SWIGTYPE && input typemaps now assume object has been moved

Replicated Java implementation.

Fully implemented for:
- C#
- D
- Guile
- Javascript (UTL)
- Lua
- MzScheme
- Octave (UTL)
- Perl (UTL)
- PHP
- Python (UTL)
- Ruby (UTL)
- Tcl (UTL)

PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
This commit is contained in:
William S Fulton 2022-08-20 15:40:53 +01:00
commit e139a36511
31 changed files with 931 additions and 46 deletions

View file

@ -40,20 +40,27 @@ try {
check::fail("is_nullptr check");
} catch (TypeError $e) {
}
$exception_thrown = false;
try {
takeKlassUniquePtr($kin);
} catch (TypeError $e) {
check::equal($e->getMessage(), "Cannot release ownership as memory is not owned for argument 1 of type 'Klass *' of takeKlassUniquePtr", "Unexpected exception: {$e->getMessage()}");
check::equal($e->getMessage(), "Cannot release ownership as memory is not owned for argument 1 of SWIGTYPE_p_Klass of takeKlassUniquePtr", "Unexpected exception: {$e->getMessage()}");
$exception_thrown = true;
}
check::equal($exception_thrown, true, "double usage of takeKlassUniquePtr should have been an error");
$kin = NULL; # Should not fail, even though already deleted
checkCount(0);
$kin = new Klass("KlassInput");
$exception_thrown = false;
$notowned = get_not_owned_ptr($kin);
try {
takeKlassUniquePtr($notowned);
} catch (TypeError $e) {
check::equal($e->getMessage(), "Cannot release ownership as memory is not owned for argument 1 of type 'Klass *' of takeKlassUniquePtr", "Unexpected exception: {$e->getMessage()}");
check::equal($e->getMessage(), "Cannot release ownership as memory is not owned for argument 1 of SWIGTYPE_p_Klass of takeKlassUniquePtr", "Unexpected exception: {$e->getMessage()}");
$exception_thrown = true;
}
check::equal($exception_thrown, true, "double usage of takeKlassUniquePtr should have been an error");
checkCount(1);
$kin = NULL;
checkCount(0);