add Environment#dump

This commit is contained in:
Josh Holtrop 2014-10-22 10:30:57 -04:00
parent d5e0475e6c
commit d9e3129ad5
2 changed files with 18 additions and 0 deletions

View File

@ -660,6 +660,13 @@ module Rscons
end
end
# Print the Environment's construction variables for debugging.
def dump
@varset.to_h.sort.each do |var, val|
puts "#{var} => #{val.inspect}"
end
end
private
# Expand target and source paths before invoking builders.

View File

@ -721,4 +721,15 @@ EOF
expect(`./two_sources`).to eq "This is a C program with two sources.\n"
end
it "supports dumping an Environment's construction variables" do
test_dir("simple")
env = Rscons::Environment.new do |env|
env["CFLAGS"] += %w[-O2 -fomit-frame-pointer]
end
env.dump
result = lines
expect(result.include?(%{CFLAGS => ["-O2", "-fomit-frame-pointer"]})).to be_truthy
expect(result.include?(%{CPPPATH => []})).to be_truthy
end
end