add Environment#clear_targets()

This commit is contained in:
Josh Holtrop 2013-12-27 13:35:16 -05:00
parent 539a49fe90
commit e667046da8
2 changed files with 17 additions and 0 deletions

View File

@ -162,6 +162,11 @@ module Rscons
cache.write cache.write
end end
# Clear all targets registered for the Environment.
def clear_targets
@targets = {}
end
# Build a command line from the given template, resolving references to # Build a command line from the given template, resolving references to
# variables using the Environment's construction variables and any extra # variables using the Environment's construction variables and any extra
# variables specified. # variables specified.

View File

@ -148,6 +148,18 @@ module Rscons
end end
end end
describe "#clear_targets" do
it "resets @targets to an empty hash" do
env = Environment.new
env.Program("a.out", "main.o")
expect(env.instance_variable_get(:@targets).keys).to eq(["a.out"])
env.clear_targets
expect(env.instance_variable_get(:@targets).keys).to eq([])
end
end
describe "#build_command" do describe "#build_command" do
it "returns a command based on the variables in the Environment" do it "returns a command based on the variables in the Environment" do
env = Environment.new env = Environment.new