fix up builders to properly use variable overrides
This commit is contained in:
1 parent
9d61fa0276
commit
08f2248ed7
9 files changed
+29
-23
No files matched your search
@@ -223,6 +223,7 @@ module Rscons
|
||||
env["path"] = ["dir1", "dir2"]
|
||||
env["flags"] = ["-x", "-y", "${specialflag}"]
|
||||
env["specialflag"] = "-z"
|
||||
env["foo"] = {}
|
||||
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/
|
||||
|
||||
@@ -125,7 +125,8 @@ module Rscons
|
||||
"CC" => "gcc",
|
||||
"CPPPATH" => ["dir1", "dir2"],
|
||||
"compiler" => "${CC}",
|
||||
"cmd" => ["${CC}", "-c", "${CFLAGS}", "-I${CPPPATH}"])
|
||||
"cmd" => ["${CC}", "-c", "${CFLAGS}", "-I${CPPPATH}"],
|
||||
"hash" => {})
|
||||
it "expands to the string itself if the string is not a variable reference" do
|
||||
v.expand_varref("CC").should == "CC"
|
||||
v.expand_varref("CPPPATH").should == "CPPPATH"
|
||||
@@ -151,8 +152,11 @@ module Rscons
|
||||
"cflag: -O2, cpppath: dir2, compiler: gcc",
|
||||
]
|
||||
end
|
||||
it "raises an error when a variable reference refers to a non-existent variable" do
|
||||
expect { v.expand_varref("${not_here}") }.to raise_error /I do not know how to expand a variable reference to a NilClass/
|
||||
it "returns an empty string when a variable reference refers to a non-existent variable" do
|
||||
expect(v.expand_varref("${not_here}")).to eq("")
|
||||
end
|
||||
it "raises an error when a variable reference refers to an unhandled type" do
|
||||
expect { v.expand_varref("${hash}") }.to raise_error /I do not know how to expand a variable reference to a Hash/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user