fix Environment#dump when construction variables are Symbols

This commit is contained in:
Josh Holtrop 2014-10-22 14:30:14 -04:00
parent dcf90cc12b
commit 99ba015630
2 changed files with 6 additions and 2 deletions

View File

@ -662,8 +662,10 @@ module Rscons
# Print the Environment's construction variables for debugging. # Print the Environment's construction variables for debugging.
def dump def dump
@varset.to_h.sort.each do |var, val| varset_hash = @varset.to_h
puts "#{var} => #{val.inspect}" varset_hash.keys.sort_by(&:to_s).each do |var|
var_str = var.is_a?(Symbol) ? var.inspect : var
puts "#{var_str} => #{varset_hash[var].inspect}"
end end
end end

View File

@ -725,9 +725,11 @@ EOF
test_dir("simple") test_dir("simple")
env = Rscons::Environment.new do |env| env = Rscons::Environment.new do |env|
env["CFLAGS"] += %w[-O2 -fomit-frame-pointer] env["CFLAGS"] += %w[-O2 -fomit-frame-pointer]
env[:foo] = :bar
end end
env.dump env.dump
result = lines result = lines
expect(result.include?(%{:foo => :bar})).to be_truthy
expect(result.include?(%{CFLAGS => ["-O2", "-fomit-frame-pointer"]})).to be_truthy expect(result.include?(%{CFLAGS => ["-O2", "-fomit-frame-pointer"]})).to be_truthy
expect(result.include?(%{CPPPATH => []})).to be_truthy expect(result.include?(%{CPPPATH => []})).to be_truthy
end end