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

Improve output for the assertion to contain #365

Open
sunesimonsen opened this issue Jan 23, 2017 · 3 comments
Open

Improve output for the assertion to contain #365

sunesimonsen opened this issue Jan 23, 2017 · 3 comments

Comments

@sunesimonsen
Copy link
Member

sunesimonsen commented Jan 23, 2017

This is out current output:

expect([0,1,2,3,4,5,6,7,8,9], 'to contain', [0,1,3,4,5,6,7,8,9])
UnexpectedError:
expected [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] to contain [ 0, 1, 3, 4, 5, 6, 7, 8, 9 ]

It would be better if we did the following:

expect([0,1,2,3,4,5,6,7,8,9], 'to contain', [0,1,3,4,5,6,7,8,9])
UnexpectedError:
expected [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] to contain [ 0, 1, 3, 4, 5, 6, 7, 8, 9 ]
  Did not contain: 2
@papandreou
Copy link
Member

to contain takes varargs, not an array of items that the subject array must contain. The first example should probably have looked like this:

> expect([0, 1, 3, 4, 5, 6, 7, 8, 9], 'to contain', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
UnexpectedError: 
expected [ 0, 1, 3, 4, 5, 6, 7, 8, 9 ] to contain 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

I think this feature req is a great idea. It should be relatively easy, so it might even work as a good "first PR".

@sunesimonsen
Copy link
Member Author

@papandreou you are right that we shouldn't output the arguments as an array either.

@HyunSangHan
Copy link

HyunSangHan commented Mar 17, 2020

@sunesimonsen @papandreou
I tried to make PR for this, but it already seems make output when I ran it like below:

> expect([0, 1, 3, 4, 5, 6, 7, 8, 9], 'to contain', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
UnexpectedError: 
expected [ 0, 1, 3, 4, 5, 6, 7, 8, 9 ] to contain 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

(same as papandreou said)

Is it already resolved? I am wondering if this issue is valid until now. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants