From df253ed22eebde57669c82ff2146f75d14cbef45 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Fri, 25 Jun 2010 00:55:24 +0000 Subject: [PATCH] - 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 --- lib/cmock_config.rb | 5 +++-- test/unit/cmock_config_test.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cmock_config.rb b/lib/cmock_config.rb index 1f1bbb3..b9bf444 100644 --- a/lib/cmock_config.rb +++ b/lib/cmock_config.rb @@ -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 diff --git a/test/unit/cmock_config_test.rb b/test/unit/cmock_config_test.rb index 04007e5..bafd544 100644 --- a/test/unit/cmock_config_test.rb +++ b/test/unit/cmock_config_test.rb @@ -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)