convert Library builder specs to integration tests

This commit is contained in:
Josh Holtrop 2017-05-22 16:54:10 -04:00
parent 7e707e7e3b
commit 957fd8c86d
3 changed files with 13 additions and 28 deletions

View File

@ -0,0 +1,4 @@
Rscons::Environment.new(echo: :command) do |env|
env["ARCMD"] = %w[ar rcf ${_TARGET} ${_SOURCES}]
env.Library("lib.a", Dir["*.c"].sort)
end

View File

@ -960,4 +960,13 @@ EOF
expect(result.stderr).to match /unknown input file type: "foo.xyz"/ expect(result.stderr).to match /unknown input file type: "foo.xyz"/
end end
end end
context "Library builder" do
it "allows overriding ARCMD construction variable" do
test_dir("library")
result = run_test(rsconsfile: "override_arcmd.rb")
expect(result.stderr).to eq ""
expect(lines(result.stdout)).to include "ar rcf lib.a one.o three.o two.o"
end
end
end end

View File

@ -1,28 +0,0 @@
module Rscons
module Builders
describe Library do
let(:env) {Environment.new}
subject {Library.new}
it "supports overriding AR construction variable" do
expect(subject).to receive(:standard_build).with("AR prog.a", "prog.a", ["sp-ar", "rcs", "prog.a", "prog.o"], ["prog.o"], env, :cache)
subject.run(
target: "prog.a",
sources: ["prog.o"],
cache: :cache,
env: env,
vars: {"AR" => "sp-ar"})
end
it "supports overriding ARCMD construction variable" do
expect(subject).to receive(:standard_build).with("AR prog.a", "prog.a", ["special", "AR!", "prog.o"], ["prog.o"], env, :cache)
subject.run(
target: "prog.a",
sources: ["prog.o"],
cache: :cache,
env: env,
vars: {"ARCMD" => ["special", "AR!", "${_SOURCES}"]})
end
end
end
end