- make config from yaml equally happy with symbols or strings (particularly for plugins)

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@172 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
mvandervoord
2010-06-25 00:55:24 +00:00
parent 15efce2860
commit df253ed22e
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -44,10 +44,11 @@ class CMockConfig
puts "WARNING: :#{opt.to_s} should be an array." unless (options[:verbosity] < 1)
end
end
options[:plugins].compact!
options[:plugins].map! {|p| p.to_sym}
@options = options
@options[:treat_as].merge!(standard_treat_as_map)
@options.each_key { |key| eval("def #{key}() return @options[:#{key}] end") }
@options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") }
end
def load_config_file_from_yaml yaml_filename
+1 -1
View File
@@ -35,7 +35,7 @@ class CMockConfigTest < Test::Unit::TestCase
end
should "replace only options specified in a yaml file" do
test_plugins = ['soda','pizza']
test_plugins = [:soda, :pizza]
test_include = 'MySillyException.h'
config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml")
assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path)