Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Render diffs for expected / actual test results #2172

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

xiongtx
Copy link
Member

@xiongtx xiongtx commented Jan 21, 2018

Renders diffs provided by clojure-emacs/cider-nrepl#478 in test result buffer.

(deftest my-test
  (is (= {:a 1 :b 2}
         {:a 2 :b 3}
         {:c "a" :d "b"})))

image

@xiongtx xiongtx changed the title Render diffs in for expected / actual test results Render diffs for expected / actual test results Jan 21, 2018
@xiongtx xiongtx force-pushed the test-diffs branch 2 times, most recently from e750f6f to 3eaec91 Compare January 21, 2018 01:09
@bbatsov
Copy link
Member

bbatsov commented Jan 22, 2018

Looks pretty cool!

Just two notes from me:

  • How is this going to look for big data structures?
  • Did you know about the ediff support in cider-test? :-)

This change also requires a changelog entry.

@xiongtx
Copy link
Member Author

xiongtx commented Jan 22, 2018

  • How is this going to look for big data structures?'

Arguably better than currently:

  1. Forms are now inserted via insert-rectangle, so they align properly
  2. actual values are displayed individually (w/ diffs below) instead of in a single (not (= ...))

Did you know about the ediff support in cider-test? :-)

I was vaguely aware of it, but Ediff:

  1. Is heavy-handed
  • Changes your window configuration or creates a new frame
  • Puts results in 2 buffers, which is total overkill for most cases
  • Requires confirmation to exit
  1. Diffs only the last value in a multi-=:

Try w/:

(deftest diff-test
  (is (= {:a 1 :b 2}
         {:a 2 :b 3}
         {:b 4 :c 5})))
  1. Compares results textually, which could be screwed up by indentation, map key order, etc.

@bbatsov
Copy link
Member

bbatsov commented Jan 22, 2018

@xiongtx I'm sold. :-)

CHANGELOG.md Outdated
@@ -2,6 +2,8 @@

## master (unreleased)

* [#2172](https://github.com/clojure-emacs/cider/pull/2172): Render diffs for expected / actual test results.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be under "New Features". :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.md Outdated
@@ -4,6 +4,10 @@

### New features

* [#2172](https://github.com/clojure-emacs/cider/pull/2172): Render diffs for expected / actual test results.

### New features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant to remove this - now we have two "New features" sections.

Copy link
Member Author

@xiongtx xiongtx Jan 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ ✅

@bbatsov bbatsov merged commit a34c8b0 into clojure-emacs:master Jan 23, 2018
@xiongtx xiongtx deleted the test-diffs branch January 23, 2018 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants