add integration test for Environment#build_sources
This commit is contained in:
parent
e58b8bd109
commit
adcee373df
14
build_tests/simple/build_sources.rb
Normal file
14
build_tests/simple/build_sources.rb
Normal file
@ -0,0 +1,14 @@
|
||||
class MyProgram < Rscons::Builder
|
||||
def run(options)
|
||||
target, sources, cache, env, vars = options.values_at(:target, :sources, :cache, :env, :vars)
|
||||
objects = env.build_sources(sources, [".o"], cache, vars)
|
||||
command = %W[gcc -o #{target}] + objects
|
||||
return false unless env.execute("#{name} #{target}", command)
|
||||
target
|
||||
end
|
||||
end
|
||||
|
||||
Rscons::Environment.new do |env|
|
||||
env.add_builder(MyProgram.new)
|
||||
env.MyProgram("simple.exe", "simple.c")
|
||||
end
|
@ -641,6 +641,16 @@ EOF
|
||||
]
|
||||
end
|
||||
|
||||
it "allows a builder to call Environment#build_sources in a non-threaded manner" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "build_sources.rb")
|
||||
expect(result.stderr).to eq ""
|
||||
expect(lines(result.stdout)).to eq [
|
||||
"CC simple.o",
|
||||
"MyProgram simple.exe",
|
||||
]
|
||||
end
|
||||
|
||||
context "Directory builder" do
|
||||
it "creates the requested directory" do
|
||||
test_dir("simple")
|
||||
|
Loading…
x
Reference in New Issue
Block a user