test re-invoking a builder if the command-line options change

This commit is contained in:
Josh Holtrop 2013-07-14 23:24:46 -04:00
parent 82cdca77f1
commit 141f8ad5ac
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,4 @@
Rscons::Environment.new do |env|
# CHANGE FLAGS
env.Program('simple', Dir['*.c'])
end

View File

@ -97,11 +97,19 @@ describe Rscons do
'CC header.o',
'LD header',
]
header_c = File.read('header.c')
File.open('header.c', 'w') do |fh|
fh.write(header_c)
end
file_sub('header.c') {|line| line}
lines = build_testdir
lines.should == []
end
it 're-links a program when the link flags have changed' do
lines = test_dir('simple')
lines.should == [
'gcc -c -o simple.o -MMD -MF simple.mf simple.c',
'gcc -o simple simple.o',
]
file_sub('build.rb') {|line| line.sub(/.*CHANGE.FLAGS.*/, ' env["LIBS"] += ["c"]')}
lines = build_testdir
lines.should == ['gcc -o simple simple.o -lc']
end
end