four new director tests

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4449 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Rose 2003-03-07 10:30:11 +00:00
commit 08e16bed8e
9 changed files with 299 additions and 0 deletions

View file

@ -0,0 +1,24 @@
import director_basic
class MyFoo(director_basic.Foo):
def ping(self):
return "MyFoo::ping()"
a = MyFoo()
if a.ping() != "MyFoo::ping()":
raise RuntimeError, a.ping()
if a.pong() != "Foo::pong();MyFoo::ping()":
raise RuntimeError, a.pong()
b = director_basic.Foo()
if b.ping() != "Foo::ping()":
raise RuntimeError, b.ping()
if b.pong() != "Foo::pong();Foo::ping()":
raise RuntimeError, b.pong()

View file

@ -0,0 +1,43 @@
from director_exception import *
from exceptions import *
class MyFoo(Foo):
def ping(self):
raise NotImplementedError, "MyFoo::ping() EXCEPTION"
class MyFoo2(Foo):
def ping(self):
pass # error: should return a string
ok = 0
a = MyFoo()
b = launder(a)
try:
b.pong()
except NotImplementedError, e:
ok = 1
except:
pass
if not ok:
raise RuntimeError
ok = 0
a = MyFoo2()
b = launder(a)
try:
b.pong()
except TypeError, e:
ok = 1
except:
pass
if not ok:
raise RuntimeError

View file

@ -0,0 +1,47 @@
from director_finalizer import *
class MyFoo(Foo):
def __del__(self):
self.orStatus(2)
Foo.__del__(self)
resetStatus()
a = MyFoo()
del a
if getStatus() != 3:
raise RuntimeError
resetStatus()
a = MyFoo()
launder(a)
if getStatus() != 0:
raise RuntimeError
del a
if getStatus() != 3:
raise RuntimeError
resetStatus()
a = MyFoo().__disown__()
deleteFoo(a)
if getStatus() != 3:
raise RuntimeError
resetStatus()
a = MyFoo().__disown__()
deleteFoo(launder(a))
if getStatus() != 3:
raise RuntimeError
resetStatus()

View file

@ -0,0 +1,17 @@
import director_unroll
class MyFoo(director_unroll.Foo):
def ping(self):
return "MyFoo::ping()"
a = MyFoo()
b = director_unroll.Bar()
b.set(a)
c = b.get()
if not (a is c):
raise RuntimeError