Hi,
My Setup
Program defines class | Test case requires Program for test method
Roman1 => Roman | tc_TestA.rb => Roman1 => testA
Roman2 => Roman | tc_TestB.rb => Roman2 => testB
Roman3 => Roman | tc_TestC.rb => Roman3 => testC
TestRomanNumberGeneration.rb is simply:
require ‘test/unit’
require ‘tc_TestA’
require ‘tc_TestB’
require ‘tc_TestC’
tc_TestA generates no test output
tc_TestB generates:
- Error
testB(TestRoman):
RuntimeError [snip]
./roman3.rb:9 in ‘initialize’
[snip]
[snip]
My Question
testB is defined in tc_TestB.rb which requires “require ‘roman2’” …
so why does it report an error ostensibly caused by roman3.rb?
My Solution
One cannot have separate files defining (or redefining?) the same
class, “Roman” in this case.
That seems to be reinforced by diagnostics for testC about redefinition
of constants, which can only occur in this case if it’s including
definitions from another program file.
So the way out is to use three different class names (which is sensible
because I’m testing different versions of the same class). I could
just do that and not bother posting, but I’d like to know that I won’t
wind up masking some other problem if the symptom goes away.
Any ideas?
Thanks in Advance,
Richard