add rspec test for overridding construction variables for an individual builer
This commit is contained in:
parent
837dff9374
commit
e04e67698a
4
build_tests/two_sources/build.rb
Normal file
4
build_tests/two_sources/build.rb
Normal file
@ -0,0 +1,4 @@
|
||||
Rscons::Environment.new(echo: :command) do |env|
|
||||
env.Object("one.o", "one.c", 'CPPFLAGS' => ['-DONE'])
|
||||
env.Program('two_sources', ['one.o', 'two.c'])
|
||||
end
|
8
build_tests/two_sources/one.c
Normal file
8
build_tests/two_sources/one.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef ONE
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("This is a C program with two sources.\n");
|
||||
}
|
||||
#endif
|
3
build_tests/two_sources/two.c
Normal file
3
build_tests/two_sources/two.c
Normal file
@ -0,0 +1,3 @@
|
||||
#ifdef ONE
|
||||
#error ONE should not be defined
|
||||
#endif
|
@ -143,4 +143,14 @@ describe Rscons do
|
||||
`./simple`.should == "This is a simple C++ program\n"
|
||||
end
|
||||
|
||||
it 'allows overriding construction variables for individual builder calls' do
|
||||
lines = test_dir('two_sources')
|
||||
lines.should == [
|
||||
'gcc -c -o one.o -MMD -MF one.mf -DONE one.c',
|
||||
'gcc -c -o two.o -MMD -MF two.mf two.c',
|
||||
'gcc -o two_sources one.o two.o',
|
||||
]
|
||||
File.exists?('two_sources').should be_true
|
||||
`./two_sources`.should == "This is a C program with two sources.\n"
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user