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

fix: print value type for interface{} containers #409

Merged
merged 1 commit into from Feb 3, 2021

Conversation

blgm
Copy link
Collaborator

@blgm blgm commented Feb 2, 2021

When a value is contained in an interface{} we should show the type of
the value as well as the interface{} type.

Consider the test:

Expect([]interface{}{1}).To(Equal([]interface{}{uint(1)}))

Previous message:

Expected
<[]interface {} | len:1, cap:1>: [1]
to equal
<[]interface {} | len:1, cap:1>: [1]

New message:

Expected
<[]interface {} | len:1, cap:1>: [1]
to equal
<[]interface {} | len:1, cap:1>: [1]

By showing the type, it's much easier to work out what is going on.

Fixes #161
Fixes #385

When a value is contained in an interface{} we should show the type of
the value as well as the interface{} type

Consider the test:

  Expect([]interface{}{1}).To(Equal([]interface{}{uint(1)}))

Previous message:

  Expected
    <[]interface {} | len:1, cap:1>: [1]
  to equal
    <[]interface {} | len:1, cap:1>: [1]

New message:

  Expected
    <[]interface {} | len:1, cap:1>: [<int>1]
  to equal
    <[]interface {} | len:1, cap:1>: [<uint>1]

By showing the type, it's much easier to work out what is going on
@onsi
Copy link
Owner

onsi commented Feb 3, 2021

this looks great - i think it's going to help alleviate a lot of confusion!

@onsi onsi merged commit f08e2dc into master Feb 3, 2021
@blgm blgm deleted the formatting-interface-types branch February 3, 2021 21:39
This was referenced Mar 8, 2021
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.

Display more information for "BeEquivalentTo" Comparing interface{}
2 participants