assert-diff 0.4.0

Assert equals with readable diff report for Crystal.

assert-diff

CI Docs GitHub release

Assert equals with readable diff report.

screenshot

Installation

  1. Add the dependency to your shard.yml:

    development_dependencies:
      assert-diff:
        github: YusukeHosonuma/assert-diff
        branch: main
    
  2. Run shards install

Example

Use in specs:

require "assert-diff"

describe "README.md" do
  it "example" do
    expected = Rectangle.new(Point.new(0, 1), 4, 7, "One\nTwo\nThree\nFour")
    actual = Rectangle.new(Point.new(0, 0), 4, 3, "Zero\nOne\nTwo!!\nThree")

    actual.should eq_diff expected # or use `eq_full_diff`
  end
end

or use assert_diff and assert_diff_full.

assert_diff(before, after)
assert_diff_full(before, after)

Use to output:

print_diff(before, after)
print_diff_full(before, after)

Contributing

I don't think it can be used for edge cases.
Issues and PRs are welcome.

  1. Fork it (https://github.com/YusukeHosonuma/assert-diff/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

assert-diff

Owner
Statistic
  • 5
  • 0
  • 1
  • 1
  • 1
  • over 3 years ago
  • April 15, 2021
License

MIT License

Links
Synced at

Sun, 22 Dec 2024 18:11:52 GMT

Languages