Replaced array each_slice with equivalent code, since build failed on OSX with Ruby 1.6 and 1.7.

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@70 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
greg-williams
2009-03-09 01:53:44 +00:00
parent c60dc79c93
commit c191121d2c
+10 -2
View File
@@ -37,12 +37,20 @@ class CMockUnityHelperParser
#scan for comparison helpers
m = Regexp.new('^\s*#define\s+(TEST_ASSERT_EQUAL_(\w+)_MESSAGE|TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(2,'\s*\w+\s*').join(',') + '\)')
a = source.scan(m).flatten.compact
a.each_slice(2) {|expect, ctype| c_types[ctype] = expect unless expect.include?("_ARRAY")}
(a.size/2).times do |i|
expect = a[i*2]
ctype = a[(i*2)+1]
c_types[ctype] = expect unless expect.include?("_ARRAY")
end
#scan for array variants of those helpers
m = Regexp.new('^\s*#define\s+(TEST_ASSERT_EQUAL_(\w+_ARRAY)_MESSAGE|TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(3,'\s*\w+\s*').join(',') + '\)')
a = source.scan(m).flatten.compact
a.each_slice(2) {|expect, ctype| c_types[ctype.gsub('_ARRAY','*')] = expect}
(a.size/2).times do |i|
expect = a[i*2]
ctype = a[(i*2)+1]
c_types[ctype.gsub('_ARRAY','*')] = expect
end
c_types
end