1
require 'director_wombat'
3
include Director_wombat
5
# Test base class functionality
8
# Bar#meth should return a Foo_integers instance
9
fooIntsObj = barObj.meth
10
raise RuntimeError unless fooIntsObj.instance_of?(Foo_integers)
12
# Foo_integers#meth(n) should return n
13
raise RuntimeError if fooIntsObj.meth(42) != 42
16
# Now subclass Foo_integers, but override its virtual method
17
# meth(n) so that it returns the number plus one.
19
class MyFooInts < Foo_integers
26
# Subclass Bar and override its virtual method meth()
27
# so that it returns a new MyFooInts instance instead of
28
# a Foo_integers instance.
37
# Now repeat previous tests:
39
# Create a MyBar instance...
43
# MyBar#meth should return a MyFooInts instance
44
fooIntsObj = barObj.meth
45
raise RuntimeError unless fooIntsObj.instance_of?(MyFooInts)
47
# MyFooInts#meth(n) should return n+1
48
raise RuntimeError if fooIntsObj.meth(42) != 43