test cloning post-build hooks
This commit is contained in:
parent
6d4f27602e
commit
a6a79b8ef1
@ -360,12 +360,16 @@ EOF
|
|||||||
it 'allows cloning all attributes of an Environment object' do
|
it 'allows cloning all attributes of an Environment object' do
|
||||||
test_dir('clone_env')
|
test_dir('clone_env')
|
||||||
|
|
||||||
|
built_targets = []
|
||||||
env1 = Rscons::Environment.new(echo: :command) do |env|
|
env1 = Rscons::Environment.new(echo: :command) do |env|
|
||||||
env.build_dir('src', 'build')
|
env.build_dir('src', 'build')
|
||||||
env['CFLAGS'] = '-O2'
|
env['CFLAGS'] = '-O2'
|
||||||
env.add_build_hook do |build_op|
|
env.add_build_hook do |build_op|
|
||||||
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
build_op[:vars]['CPPFLAGS'] = '-DSTRING="Hello"'
|
||||||
end
|
end
|
||||||
|
env.add_post_build_hook do |build_op|
|
||||||
|
built_targets << build_op[:target]
|
||||||
|
end
|
||||||
env.Program('program', Dir['src/*.c'])
|
env.Program('program', Dir['src/*.c'])
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -378,6 +382,12 @@ EOF
|
|||||||
%Q{gcc -o program#{env1["PROGSUFFIX"]} build/program.o},
|
%Q{gcc -o program#{env1["PROGSUFFIX"]} build/program.o},
|
||||||
%Q{gcc -o program2#{env2["PROGSUFFIX"]} build/program.o},
|
%Q{gcc -o program2#{env2["PROGSUFFIX"]} build/program.o},
|
||||||
]
|
]
|
||||||
|
expect(built_targets).to eq([
|
||||||
|
"build/program.o",
|
||||||
|
"program#{env1['PROGSUFFIX']}",
|
||||||
|
"build/program.o",
|
||||||
|
"program2#{env1['PROGSUFFIX']}",
|
||||||
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'builds a C++ program with one source file' do
|
it 'builds a C++ program with one source file' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user