Skip to content

Instantly share code, notes, and snippets.

@mattantonelli
Created May 27, 2014 16:39
Show Gist options
  • Save mattantonelli/73a0e4a1edcf05bd3a69 to your computer and use it in GitHub Desktop.
Save mattantonelli/73a0e4a1edcf05bd3a69 to your computer and use it in GitHub Desktop.
assertEquals() Test Generator
input_path = "input.txt"
output = File.open("output.txt", "w")
File.readlines(input_path).each do |line|
if(line.include?("testGet"))
output.puts line
get_method = line[/Get.*\(\)/]
get_method[0] = get_method[0].downcase
test = "\t\tassertEquals(, record." << get_method << ");"
output.puts test
elsif(!line.include?("fail"))
output.puts line
end
end
output.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment