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

Ignore 'No newline at end of file' warning message when comparing text strings #88

Open
harmanbirdi opened this issue Jul 6, 2017 · 4 comments

Comments

@harmanbirdi
Copy link

It does not make any sense for that message to show up on comparison of two strings.
I have not seen the code, but seems like you are taking two strings, putting them in
two files and comparing them. Could you provide an option to suppress that warning.

It would be nice to not be able to see that warning especially when comparing
a lot of strings.

@dannolan
Copy link

It would be extremely great to have this btw

@samg
Copy link
Owner

samg commented Sep 28, 2017 via email

@bmaca
Copy link

bmaca commented Nov 29, 2017

I agree. This would be nice to have

@DannyBen
Copy link

I also came here to look for a way to remove this warning, but since I see this is a long-running open issue, and since it seems to be the accepted behavior for the underlying diff command, I figured "if you can't beat them, join them". I am simply adding a newline to both compared strings before comparing:

def diff
  @diff ||= Diffy::Diff.new("#{expected}\n", "#{actual}\n", context: 2).to_s :color
end

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

No branches or pull requests

5 participants