12 require 'director_wombat'
14 include Director_wombat
16 # Test base class functionality
19 # Bar#meth should return a Foo_integers instance
20 fooIntsObj = barObj.meth
21 raise RuntimeError unless fooIntsObj.instance_of?(Foo_integers)
23 # Foo_integers#meth(n) should return n
24 raise RuntimeError if fooIntsObj.meth(42) != 42
27 # Now subclass Foo_integers, but override its virtual method
28 # meth(n) so that it returns the number plus one.
30 class MyFooInts < Foo_integers
37 # Subclass Bar and override its virtual method meth()
38 # so that it returns a new MyFooInts instance instead of
39 # a Foo_integers instance.
48 # Now repeat previous tests:
50 # Create a MyBar instance...
54 # MyBar#meth should return a MyFooInts instance
55 fooIntsObj = barObj.meth
56 raise RuntimeError unless fooIntsObj.instance_of?(MyFooInts)
58 # MyFooInts#meth(n) should return n+1
59 raise RuntimeError if fooIntsObj.meth(42) != 43