https://github.com/yusukehosonuma/assert-diff
Assert equals with readable diff report for Crystal.
https://github.com/yusukehosonuma/assert-diff
assert crystal diff test
Last synced: 2 months ago
JSON representation
Assert equals with readable diff report for Crystal.
- Host: GitHub
- URL: https://github.com/yusukehosonuma/assert-diff
- Owner: YusukeHosonuma
- License: mit
- Created: 2021-04-15T05:33:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-28T07:45:56.000Z (over 4 years ago)
- Last Synced: 2025-04-06T10:12:47.835Z (9 months ago)
- Topics: assert, crystal, diff, test
- Language: Crystal
- Homepage: https://yusukehosonuma.github.io/assert-diff/
- Size: 707 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# assert-diff
[](https://github.com/YusukeHosonuma/assert-diff/actions/workflows/main.yaml)
[](https://yusukehosonuma.github.io/assert-diff/)
[](https://github.com/YusukeHosonuma/assert-diff/releases)
Assert equals with readable diff report.

## Installation
1. Add the dependency to your `shard.yml`:
```yaml
development_dependencies:
assert-diff:
github: YusukeHosonuma/assert-diff
branch: main
```
2. Run `shards install`
## Example
Use in specs:
```crystal
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`.
```crystal
assert_diff(before, after)
assert_diff_full(before, after)
```
Use to output:
```crystal
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 ()
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
- [Yusuke Hosonuma](https://github.com/YusukeHosonuma) - creator and maintainer