finish up Environment specs
This commit is contained in:
parent
797580e937
commit
a418d31000
@ -28,6 +28,14 @@ module Rscons
|
|||||||
env.builders.find {|name, builder| name == "Program"}.should_not be_nil
|
env.builders.find {|name, builder| name == "Program"}.should_not be_nil
|
||||||
env.builders.find {|name, builder| name == "Library"}.should be_nil
|
env.builders.find {|name, builder| name == "Library"}.should be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when a block is given" do
|
||||||
|
it "yields self and invokes #process()" do
|
||||||
|
env = Environment.new do |env|
|
||||||
|
env.should_receive(:process)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#clone" do
|
describe "#clone" do
|
||||||
@ -39,6 +47,15 @@ module Rscons
|
|||||||
env["CPPPATH"].should == ["path1"]
|
env["CPPPATH"].should == ["path1"]
|
||||||
env2["CPPPATH"].should == ["path1", "path2"]
|
env2["CPPPATH"].should == ["path1", "path2"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when a block is given" do
|
||||||
|
it "yields self and invokes #process()" do
|
||||||
|
env = Environment.new
|
||||||
|
env.clone do |env2|
|
||||||
|
env2.should_receive(:process)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#add_builder" do
|
describe "#add_builder" do
|
||||||
@ -228,6 +245,25 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#run_builder" do
|
||||||
|
it "tweaks the construction variables using given tweakers and invokes the builder" do
|
||||||
|
env = Environment.new
|
||||||
|
env.add_tweaker do |build_op|
|
||||||
|
if build_op[:sources].first =~ %r{src/special}
|
||||||
|
build_op[:vars]["CFLAGS"] += ["-O3", "-DSPECIAL"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
env.builders["Object"].stub(:run) do |target, sources, cache, env, vars|
|
||||||
|
vars["CFLAGS"].should == []
|
||||||
|
end
|
||||||
|
env.run_builder(env.builders["Object"], "build/normal/module.o", ["src/normal/module.c"], "cache", {})
|
||||||
|
env.builders["Object"].stub(:run) do |target, sources, cache, env, vars|
|
||||||
|
vars["CFLAGS"].should == ["-O3", "-DSPECIAL"]
|
||||||
|
end
|
||||||
|
env.run_builder(env.builders["Object"], "build/special/module.o", ["src/special/module.c"], "cache", {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe ".parse_makefile_deps" do
|
describe ".parse_makefile_deps" do
|
||||||
it 'handles dependencies on one line' do
|
it 'handles dependencies on one line' do
|
||||||
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user