- Modified generate_test_runner.rb to generate unit test main() with int main(void) instead of void main(void) in order to work with GCC

- Removed unused methods from unity_test_summary.rb

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@6 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
greg-williams
2008-11-07 14:36:10 +00:00
parent 8fb0204021
commit 8f6a7ad770
2 changed files with 2 additions and 45 deletions

View File

@ -79,7 +79,6 @@ class UnityTestSummary
def set_root_path(path)
@root = path
puts "root_path = " + @root
end
protected
@ -147,49 +146,6 @@ class UnityTestSummary
end
def here; File.expand_path(File.dirname(__FILE__)); end
def valid_file(fname)
raise "Can't find file #{fname}" unless File.exists?(fname)
fname
end
def valid_dir(dirname)
raise "Can't find dir #{dirname}" unless File.exists?(dirname)
dirname
end
def search_file_and_replace(file_name, pattern, replacement)
text = File.read(valid_file(file_name))
text.gsub!(pattern, replacement)
File.open(file_name, "w") do |f| f.write text end
end
def create_file_from_template(dest_file, template_file)
raise "#{dest_file} already exists; remove it first" if File.exists?(dest_file)
template_file = valid_file("#{here}/rscript_template.rb")
template = ERB.new(File.read(template_file))
File.open(dest_file,"w") do |f|
f.write template.result(binding)
end
end
def humanize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
end
def camelize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
end
def titleize(word)
humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize }
end
def underscore(camel_cased_word)
camel_cased_word.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase
end
end