Repository navigation
AssertEqual: better display of unequal dicts/list - #120
Merged
junegunn merged 1 commit intoFeb 25, 2017
Merged
Conversation
This adds a newline (with indentation) before each value to make it easier to visually grasp the change.
Owner
|
Looks useful, thanks! |
|
This renders like this for me: |
Collaborator
Author
|
@adriaanzon |
|
On both vim and neovim, using Arch Linux. This happens in interactive vim sessions. I wasn't aware that there's also output in non-interactive vim-sessions, because neovim doesn't output anything when exiting vim immediately using |
Owner
|
Hmm, sorry for not paying close attention. I'd like the output of the interactive session to be fixed. A quick and dirty patch: diff --git a/autoload/vader.vim b/autoload/vader.vim
index 9036654..8bb5506 100644
--- a/autoload/vader.vim
+++ b/autoload/vader.vim
@@ -25,8 +25,13 @@ let s:register = {}
let s:register_undefined = []
let s:indent = 2
+function! vader#interactive()
+ return !s:bang
+endfunction
+
function! vader#run(bang, ...) range
let s:error_line = 0
+ let s:bang = a:bang
if a:lastline - a:firstline > 0
if a:0 > 1
diff --git a/autoload/vader/assert.vim b/autoload/vader/assert.vim
index 2e29b86..7c25a69 100644
--- a/autoload/vader/assert.vim
+++ b/autoload/vader/assert.vim
@@ -76,7 +76,7 @@ function! vader#assert#equal(...)
call s:check_types(Exp, Got)
if Exp !=# Got
let type = type(Exp)
- let msg = (type == type({}) || type == type([]))
+ let msg = ((type == type({}) || type == type([])) && !vader#interactive())
\ ? printf("Unequal %ss\n %%s should be equal to \n %%s", get(s:type_names, type))
\ : "%s should be equal to %s"
throw get(a:000, 2, printf(msg, string(Got), string(Exp))) |
blueyed
added a commit
to blueyed/vader.vim
that referenced
this pull request
Mar 11, 2017
blueyed
added a commit
to blueyed/vader.vim
that referenced
this pull request
Mar 11, 2017
blueyed
added a commit
to blueyed/vader.vim
that referenced
this pull request
Mar 11, 2017
blueyed
added a commit
to blueyed/vader.vim
that referenced
this pull request
Apr 21, 2017
blueyed
added a commit
to blueyed/vader.vim
that referenced
this pull request
Mar 25, 2018
blueyed
added a commit
to blueyed/vader.vim
that referenced
this pull request
Mar 25, 2018
hupfdule
pushed a commit
to hupfdule/vader.vim
that referenced
this pull request
May 6, 2020
This adds a newline (with indentation) before each value to make it easier to visually grasp the change.
hupfdule
pushed a commit
to hupfdule/vader.vim
that referenced
this pull request
May 28, 2020
This adds a newline (with indentation) before each value to make it easier to visually grasp the change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a newline (with indentation) before each value to make it
easier to visually grasp the change.