Use PHP objects instead of resources to wrap pointers
Pointer to member is currently still wrapped as a resource.
This commit is contained in:
parent
f1aaeeea1c
commit
c705ef8f32
9 changed files with 107 additions and 118 deletions
|
|
@ -24,7 +24,7 @@ check::equal(5,intp_value($tr),"5==$tr");
|
|||
# Check the voidhandle call, first with null
|
||||
$handle=NULL;
|
||||
voidhandle($handle);
|
||||
check::resource($handle,"_p_void",'$handle is not _p_void');
|
||||
check::equal(get_class($handle),"SWIG\\_p_void",'$handle is not _p_void');
|
||||
$handledata=handle($handle);
|
||||
check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
require "tests.php";
|
||||
require "callback.php";
|
||||
|
||||
// In 2.0.6 and earlier, the constant was misnamed.
|
||||
if (gettype(callback::FOO_I_Cb_Ptr) !== 'resource') die("callback::FOO_I_Cb_Ptr not a resource\n");
|
||||
check::equal(gettype(callback::FOO_I_Cb_Ptr), 'object', "callback::FOO_I_Cb_Ptr not an object");
|
||||
|
||||
check::equal(get_class(callback::FOO_I_Cb_Ptr), 'SWIG\_p_f_int__int', "callback::FOO_I_Cb_Ptr not expected class");
|
||||
|
||||
check::done();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require "grouping.php";
|
|||
|
||||
check::functions(array("test1","test2","do_unary","negate"));
|
||||
check::equal(5,test1(5),"5==test1(5)");
|
||||
check::resource(test2(7),"_p_int","_p_int==test2(7)");
|
||||
check::equal(get_class(test2(7)),"SWIG\\_p_int","test2(7) is _p_int");
|
||||
check::globals(array('test3'));
|
||||
|
||||
//check::equal(37,test3_get(),'37==test3_get()');
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ class check {
|
|||
if (! is_array($extra)) {
|
||||
$df=array_flip(get_declared_classes());
|
||||
foreach($_original_classes as $class) unset($df[$class]);
|
||||
// Filter out pointer wrappers such as SWIG/_p_int.
|
||||
foreach(array_keys($df) as $class) {
|
||||
if (preg_match('/^SWIG\\\\/', $class)) unset($df[$class]);
|
||||
}
|
||||
$extra=array_keys($df);
|
||||
}
|
||||
return $extra;
|
||||
|
|
@ -202,10 +206,6 @@ class check {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static function resource($a,$b,$message) {
|
||||
return check::equal(get_resource_type($a), $b, $message);
|
||||
}
|
||||
|
||||
static function isnull($a,$message) {
|
||||
return check::equal($a,NULL,$message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue