mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-04 01:10:01 +00:00
Update to latest Unity and therefore newer Rubocop standards. Tweaked scripts to match latest standards.
This commit is contained in:
@@ -38,12 +38,13 @@ class CMockUnityHelperParser
|
||||
if ctype.is_a?(Symbol)
|
||||
raise ":treat_as expects a list of identifier: identifier mappings, but got a symbol: #{ctype}. Check the indentation in your project.yml"
|
||||
end
|
||||
|
||||
c_type = ctype.gsub(/\s+/, '_')
|
||||
if expecttype =~ /\*/
|
||||
c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.delete('*')}_ARRAY"
|
||||
else
|
||||
c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}"
|
||||
c_types[c_type + '*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY"
|
||||
c_types["#{c_type}*"] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY"
|
||||
end
|
||||
end
|
||||
c_types
|
||||
@@ -58,7 +59,7 @@ class CMockUnityHelperParser
|
||||
source = source.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
||||
|
||||
# scan for comparison helpers
|
||||
match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4, '\s*\w+\s*').join(',') + '\)')
|
||||
match_regex = Regexp.new("^\\s*#define\\s+(UNITY_TEST_ASSERT_EQUAL_(\\w+))\\s*\\(#{Array.new(4, '\s*\w+\s*').join(',')}\\)")
|
||||
pairs = source.scan(match_regex).flatten.compact
|
||||
(pairs.size / 2).times do |i|
|
||||
expect = pairs[i * 2]
|
||||
@@ -67,7 +68,7 @@ class CMockUnityHelperParser
|
||||
end
|
||||
|
||||
# scan for array variants of those helpers
|
||||
match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5, '\s*\w+\s*').join(',') + '\)')
|
||||
match_regex = Regexp.new("^\\s*#define\\s+(UNITY_TEST_ASSERT_EQUAL_(\\w+_ARRAY))\\s*\\(#{Array.new(5, '\s*\w+\s*').join(',')}\\)")
|
||||
pairs = source.scan(match_regex).flatten.compact
|
||||
(pairs.size / 2).times do |i|
|
||||
expect = pairs[i * 2]
|
||||
|
||||
Reference in New Issue
Block a user