项目作者: YusukeHosonuma

项目描述 :
Assert equals with readable diff report for Crystal.
高级语言: Crystal
项目地址: git://github.com/YusukeHosonuma/assert-diff.git
创建时间: 2021-04-15T05:33:52Z
项目社区:https://github.com/YusukeHosonuma/assert-diff

开源协议:MIT License

下载


assert-diff

CI
Docs
GitHub release

Assert equals with readable diff report.

screenshot

Installation

  1. Add the dependency to your shard.yml:

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

Example

Use in specs:

  1. require "assert-diff"
  2. describe "README.md" do
  3. it "example" do
  4. expected = Rectangle.new(Point.new(0, 1), 4, 7, "One\nTwo\nThree\nFour")
  5. actual = Rectangle.new(Point.new(0, 0), 4, 3, "Zero\nOne\nTwo!!\nThree")
  6. actual.should eq_diff expected # or use `eq_full_diff`
  7. end
  8. end

or use assert_diff and assert_diff_full.

  1. assert_diff(before, after)
  2. assert_diff_full(before, after)

Use to output:

  1. print_diff(before, after)
  2. 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