diff --git a/build_tests/simple/build.rb b/build_tests/simple/build.rb index 9775f9a..e109562 100644 --- a/build_tests/simple/build.rb +++ b/build_tests/simple/build.rb @@ -1,3 +1,4 @@ Rscons::Environment.new do |env| + # CHANGE FLAGS env.Program('simple', Dir['*.c']) end diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index c96bcfc..a3d5c0c 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -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