add Environment#expand_varref()
This commit is contained in:
parent
e3aadc562f
commit
5ff555cf6a
@ -185,6 +185,11 @@ module Rscons
|
|||||||
@varset.merge(extra_vars).expand_varref(command_template)
|
@varset.merge(extra_vars).expand_varref(command_template)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Expand a construction variable reference (String or Array)
|
||||||
|
def expand_varref(varref)
|
||||||
|
@varset.expand_varref(varref)
|
||||||
|
end
|
||||||
|
|
||||||
# Execute a builder command
|
# Execute a builder command
|
||||||
# @param short_desc [String] Message to print if the Environment's echo
|
# @param short_desc [String] Message to print if the Environment's echo
|
||||||
# mode is set to :short
|
# mode is set to :short
|
||||||
|
@ -199,6 +199,20 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#expand_varref" do
|
||||||
|
it "returns the fully expanded variable reference" do
|
||||||
|
env = Environment.new
|
||||||
|
env["path"] = ["dir1", "dir2"]
|
||||||
|
env["flags"] = ["-x", "-y", "${specialflag}"]
|
||||||
|
env["specialflag"] = "-z"
|
||||||
|
env.expand_varref(["-p${path}", "${flags}"]).should == ["-pdir1", "-pdir2", "-x", "-y", "-z"]
|
||||||
|
env.expand_varref("foo").should == "foo"
|
||||||
|
expect {env.expand_varref("${foo}")}.to raise_error /expand.a.variable.reference/
|
||||||
|
env.expand_varref("${specialflag}").should == "-z"
|
||||||
|
env.expand_varref("${path}").should == ["dir1", "dir2"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#execute" do
|
describe "#execute" do
|
||||||
context "with echo: :short" do
|
context "with echo: :short" do
|
||||||
context "with no errors" do
|
context "with no errors" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user