Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add test suite #53

Merged
merged 1 commit into from
Feb 13, 2016
Merged

Add test suite #53

merged 1 commit into from
Feb 13, 2016

Conversation

paulirish
Copy link
Member

  • Test suite setup with Bats
  • Assertion library courtesy of the very well done bats-assert

Fixtures

I've set up a few fixtures, based on some tricky cases.

# creating a fixture file:
git --no-pager diff .  > fixture.diff
# running it directly:
cat fixture.diff | ./diff-so-fancy

Assertions

The basics look like this:

output=$( load_fixture "ls-function" | $diff_so_fancy )

@test "that it doesnt break" {
  assert_output --partial "diff: "
  refute_output --partial "index 33c3d8b"
}

Between bats and bats-assert there is indended to be support for something like assert_line --index 7 to define specific lines of output`, however I was unable to make that work. I believe its a bug between empty text lines and the escape codes.

CI

This is setup with CircleCI, which works great. The Travis bots are crazy slow for me (though it does work), so I'd prefer being on CircleCI for now.
image
https://circleci.com/gh/paulirish/diff-so-fancy

Fixes #32

@stevemao
Copy link
Member

🎉 Thanks @paulirish , This is so great!
Do I need to enable the hook to make CI work?

@paulirish
Copy link
Member Author

@stevemao no you just need to # with CircleCI and the permissions you grant them will take care of it.

@paulirish
Copy link
Member Author

i'd be a fan of merging this earlier than later. shall we?

stevemao added a commit that referenced this pull request Feb 13, 2016
@stevemao stevemao merged commit 04cfd67 into master Feb 13, 2016
@stevemao stevemao deleted the test-suite branch February 13, 2016 01:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test suite
2 participants