mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
Handle yaml.load in a way that is ruby version agnostic.
This commit is contained in:
@@ -9,9 +9,17 @@ module RakefileHelpers
|
||||
|
||||
C_EXTENSION = '.c'.freeze
|
||||
|
||||
def load_yaml(yaml_string)
|
||||
begin
|
||||
return YAML.load(yaml_string, aliases: true)
|
||||
rescue ArgumentError
|
||||
return YAML.load(yaml_string)
|
||||
end
|
||||
end
|
||||
|
||||
def load_configuration(config_file)
|
||||
$cfg_file = config_file
|
||||
$cfg = YAML.load(File.read($cfg_file))
|
||||
$cfg = load_yaml(File.read('./targets/' + $cfg_file))
|
||||
$colour_output = false unless $cfg['colour']
|
||||
end
|
||||
|
||||
|
||||
+5
-1
@@ -108,7 +108,11 @@ class CMockConfig
|
||||
def self.load_config_file_from_yaml(yaml_filename)
|
||||
require 'yaml'
|
||||
require 'fileutils'
|
||||
YAML.load_file(yaml_filename)[:cmock]
|
||||
begin
|
||||
return YAML.load_file(yaml_filename, aliases: true)[:cmock]
|
||||
rescue ArgumentError
|
||||
return YAML.load_file(yaml_filename)[:cmock]
|
||||
end
|
||||
end
|
||||
|
||||
def path(new_path)
|
||||
|
||||
+12
-3
@@ -19,9 +19,18 @@ module RakefileHelpers
|
||||
C_EXTENSION = '.c'
|
||||
RESULT_EXTENSION = '.result'
|
||||
|
||||
def load_yaml(yaml_filename)
|
||||
yaml_string = File.read(yaml_filename)
|
||||
begin
|
||||
return YAML.load(yaml_string, aliases: true)
|
||||
rescue ArgumentError
|
||||
return YAML.load(yaml_string)
|
||||
end
|
||||
end
|
||||
|
||||
def load_configuration(config_file)
|
||||
$cfg_file = config_file
|
||||
$cfg = YAML.load(File.read('./targets/' + $cfg_file))
|
||||
$cfg = load_yaml('./targets/' + $cfg_file)
|
||||
$colour_output = false unless $cfg['colour']
|
||||
end
|
||||
|
||||
@@ -252,7 +261,7 @@ module RakefileHelpers
|
||||
failure_messages = []
|
||||
|
||||
test_case_files.each do |test_case|
|
||||
tests = (YAML.load_file(test_case))[:systest][:tests][:units]
|
||||
tests = (load_yaml(test_case))[:systest][:tests][:units]
|
||||
total_tests += tests.size
|
||||
|
||||
test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION)
|
||||
@@ -367,7 +376,7 @@ module RakefileHelpers
|
||||
report "----------------\n"
|
||||
errors = false
|
||||
FileList.new("c/*.yml").each do |yaml_file|
|
||||
test = YAML.load(File.read(yaml_file))
|
||||
test = load_yaml(yaml_file)
|
||||
report "\nTesting #{yaml_file.sub('.yml','')}"
|
||||
report "(#{test[:options].join(', ')})"
|
||||
test[:files].each { |f| compile(f, test[:options]) }
|
||||
|
||||
Vendored
+1
-1
Submodule vendor/unity updated: 4389bab82e...5204c1bacf
Reference in New Issue
Block a user