pakoito
03/20/2019, 11:45 PMpakoito
03/20/2019, 11:46 PMpakoito
03/20/2019, 11:46 PMpakoito
03/20/2019, 11:47 PMpakoito
03/20/2019, 11:47 PMraulraja
03/20/2019, 11:56 PMsam
03/21/2019, 12:01 AMsam
03/21/2019, 12:01 AMsam
03/21/2019, 12:01 AMsam
03/21/2019, 12:01 AMsam
03/21/2019, 12:04 AMShow
to generate nicer messages when assertions fail. So users can provide better string representations of custom classes. What's your recommended way of discovery? Two options spring to mind for me - SPI or having the instances live in a pre-defined package and using Class.forName. Another problem is I don't know what to do for Show<List<String>> in either of those ideasraulraja
03/21/2019, 12:09 AMraulraja
03/21/2019, 12:09 AM@extension
interface ListKShow<A> : Show<ListKOf<A>> {
override fun ListKOf<A>.show(): String =
toString()
}
you get for free at the package level .show()
raulraja
03/21/2019, 12:10 AMraulraja
03/21/2019, 12:10 AMraulraja
03/21/2019, 12:10 AMraulraja
03/21/2019, 12:10 AMShow<A>
raulraja
03/21/2019, 12:11 AMsam
03/21/2019, 12:44 AMsam
03/21/2019, 12:45 AMraulraja
03/21/2019, 12:51 AMraulraja
03/21/2019, 12:51 AMraulraja
03/21/2019, 12:52 AMShow<A>
for the type they are testing which allows you to call show()
raulraja
03/21/2019, 12:52 AMraulraja
03/21/2019, 12:53 AMfun <A> Show<A>.prettyPrint(a: A): String =
a.show()
raulraja
03/21/2019, 12:54 AMraulraja
03/21/2019, 12:54 AMprettyPrint
raulraja
03/21/2019, 12:56 AMclass CustomScope<A>(SA: Show<A>): Show<A> by A {
... a.show()
}
sam
03/21/2019, 1:01 AMdata class Person(name: String)
and you write a test like person.shouldBe(Person("sam"))
I want to have a better to string for person.sam
03/21/2019, 1:02 AMperson.shouldBe(Person("sam"))
inside the scope of a Show<Person>