On Sat, Jan 17, 2009 at 6:48 AM, Ed Keith [email protected] wrote:
I looked at Cucumber, I’m not clear on what it does, but I do not think
language for the driver scripts. My first thought was to use Python
What about…Ruby?
I think it would make a lot of sense to define a couple hashes/objects
that represent each compiler. If you’re just using different strings,
you can use a hash.
gcc = {:name => ‘gcc’, :command => ‘gcc’, :flags => ‘…’}
pcc = {:name => ‘pcc’, :command => ‘pcc’, :flags => ‘…’}
watcom = {:name => ‘watcom’, :command => ‘wcm’, :flags => ‘…’}
[gcc, pcc, watcom].each do |compiler|
describe “#{compiler[:name] compiler” do
it “should build the binary” do
Dir.chdir(project_dir) { exec “make
COMPILER=#{compiler[:command]} FLAGS='#{compiler[:flags]}” }
build_binary.exit_code.should == 0
end
end
You probably wouldn’t put the compiler definitions right in there, but
you could if you wanted to. But putting them in another file is easy
and good.
If you need more complex setup, create helper classes.
class GccCompiler
def setup
# create some files…
end
def name; “gcc” end
def command; “gcc” end
end
Same thing then, you create a new instance of each of these classes,
iterate through, call their setup method, etc.
Pat