add backwards-compatibility test for Builder#standard_build
This commit is contained in:
parent
b454208117
commit
83226e894d
17
build_tests/simple/standard_build.rb
Normal file
17
build_tests/simple/standard_build.rb
Normal file
@ -0,0 +1,17 @@
|
||||
class MyCommand < Rscons::Builder
|
||||
def run(target, sources, cache, env, vars)
|
||||
vars = vars.merge({
|
||||
"_TARGET" => target,
|
||||
"_SOURCES" => sources,
|
||||
})
|
||||
command = env.build_command("${CMD}", vars)
|
||||
cmd_desc = vars["CMD_DESC"] || "MyCommand"
|
||||
standard_build("#{cmd_desc} #{target}", target, command, sources, env, cache)
|
||||
end
|
||||
end
|
||||
|
||||
Rscons::Environment.new do |env|
|
||||
env.add_builder(MyCommand.new)
|
||||
command = %w[gcc -c -o ${_TARGET} ${_SOURCES}]
|
||||
env.MyCommand("simple.o", "simple.c", "CMD" => command)
|
||||
end
|
@ -631,6 +631,7 @@ EOF
|
||||
]
|
||||
end
|
||||
|
||||
context "backward compatibility" do
|
||||
it "allows a builder to call Environment#run_builder in a non-threaded manner" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "run_builder.rb")
|
||||
@ -662,6 +663,14 @@ EOF
|
||||
expect(result.stdout).to match /Failed command was: gcc/
|
||||
end
|
||||
|
||||
it "supports builders that call Builder#standard_build" do
|
||||
test_dir("simple")
|
||||
result = run_test(rsconsfile: "standard_build.rb")
|
||||
expect(result.stderr).to eq ""
|
||||
expect(lines(result.stdout)).to eq ["MyCommand simple.o"]
|
||||
end
|
||||
end
|
||||
|
||||
context "Directory builder" do
|
||||
it "creates the requested directory" do
|
||||
test_dir("simple")
|
||||
|
Loading…
x
Reference in New Issue
Block a user