From c191121d2c609f22872bf5533ddc07eebee3998e Mon Sep 17 00:00:00 2001 From: greg-williams Date: Mon, 9 Mar 2009 01:53:44 +0000 Subject: [PATCH] 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 --- lib/cmock_unityhelper_parser.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cmock_unityhelper_parser.rb b/lib/cmock_unityhelper_parser.rb index 0835023..2ba6113 100644 --- a/lib/cmock_unityhelper_parser.rb +++ b/lib/cmock_unityhelper_parser.rb @@ -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