You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
name: [name] -> The 'name' of the object you are asserting on, this can be passed in with assertThat(actual, name = "name") and it's calculated automatically for some methods like prop.
message: <"[Bob]"> but was:<"[Sue]"> the actual failure, expressed with expected() or fail().
context: (Person(name=Sue, age=22) the object you are asserting on. There is currently no way to set this but it's displayed automatically when you are asserting on a piece of it with methods like prop.
The problem is there is no way to customize what's displayed for the context. If the class you are asserting on doesn't implement toString() in a useful way you are out of luck.
Some ideas to solve this:
Allow passing in a custom context
We can do this like you can pass in a custom name now. Would have to think about the name, not sure that context is the best name for this, not much thought was put into the naming as it's only used internally currently.
Allow some sort of customization of show()
Right now show() is hard-coded to handle specific platform types falling back to toString(). Need to think about the api for this, are we customizing all shows() in the assertion or just the context one?
The text was updated successfully, but these errors were encountered:
In assertk the failure message is made up of 3 parts:
name: [name]
-> The 'name' of the object you are asserting on, this can be passed in withassertThat(actual, name = "name")
and it's calculated automatically for some methods likeprop
.message: <"[Bob]"> but was:<"[Sue]">
the actual failure, expressed withexpected()
orfail()
.context: (Person(name=Sue, age=22)
the object you are asserting on. There is currently no way to set this but it's displayed automatically when you are asserting on a piece of it with methods likeprop
.The problem is there is no way to customize what's displayed for the context. If the class you are asserting on doesn't implement
toString()
in a useful way you are out of luck.Some ideas to solve this:
context
We can do this like you can pass in a custom
name
now. Would have to think about the name, not sure that context is the best name for this, not much thought was put into the naming as it's only used internally currently.show()
Right now
show()
is hard-coded to handle specific platform types falling back totoString()
. Need to think about the api for this, are we customizing allshows()
in the assertion or just the context one?The text was updated successfully, but these errors were encountered: