Add new test and make it work

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12268 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vincent Couvert 2010-10-14 12:38:34 +00:00
commit 64bb416577
2 changed files with 18 additions and 3 deletions

View file

@ -6,8 +6,23 @@ catch
swigtesterror();
end
// Test default values
if test_myInt_get(a) <> 100 then swigtesterror(); end
if test_myShort_get(a) <> 200 then swigtesterror(); end
if test_myShort_get(a) != 200 then swigtesterror(); end
// Write new values
try
test_myInt_set(a, 42)
test_myShort_set(a, 12)
catch
swigtesterror();
end
exec("swigtest.quit", -1);
// Read new values
if test_myInt_get(a) <> 42 then swigtesterror(); end
if test_myShort_get(a) <> 12 then swigtesterror(); end
// Destroy pointer
delete_test(a);
exec("swigtest.quit", -1);

View file

@ -1208,7 +1208,7 @@
}
%typemap(out) SWIGTYPE {
sciErr = createPointer(pvApiCtx, iVarOut, (void *)&$result);
sciErr = createPointer(pvApiCtx, iVarOut, %new_copy($result, $1_ltype));
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;