Project

linebyline

0.0
No commit activity in last 3 years
No release in over 3 years
Can be used for comparing long outputs to references
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8.4
 Project Readme

linebyline¶ ↑

Facilitates the comparison of files and IO buffers in tests. It will report the exact differences per line and character offset, it will report if lines are too short or too long, and so on.

To use, include it in Minitest or Test::Unit

include LineByLine::Assertions

# ... and in one of your tests
def test_outputs_same
  ref = File.open('ref_data.txt')
  out = File.open('my_output.txt')
  assert_same_buffer ref, out
end

The Assertions module expects the following methods on the object it is included into:

flunk(message)
assert(boolean)

so you can retrofit it to your Testing Framework Du Jour. Or you can include LineByLine itself, and then use compare_buffer! like so:

include LineByLine

# ... more tests
begin
  compare_buffers! ref, out
rescue LineByLine::NotSame => mismatch
  fail_test mismatch.message
end

Contributing to linebyline¶ ↑

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 Julik Tarkhanov. See LICENSE.txt for further details.