Skip to content

Instantly share code, notes, and snippets.

View ghostbuster91's full-sized avatar

Kasper Kondzielski ghostbuster91

View GitHub Profile
import com.softwaremill.diffx.scalatest.DiffMatcher._
it should "compare mikes" in {
Person(11, "Mike") should matchTo(Person(12, "Mike"))
}
type Id = String @@ Person
implicit val dm : Diff[Id] = Diff.identical[Id]
implicit val om: ObjectMatcher[Person] = new ObjectMatcher[Person] {
override def isSameObject(left: Person, right: Person): Boolean = {
left.name == right.name
}
}
case class Person(age: Int, name: String)
implicit def diffForLocalDate(difForString: Diff[String]): Diff[LocalDate] =
new Diff[LocalDate] {
override def apply(left: LocalDate, right: LocalDate,
toIgnore: List[FieldPath]): DiffResult = {
val formatter = DateTimeFormatter.ISO_DATE
difForString.apply(formatter.format(left), formatter.format(right))
}
}
case class Person(age: Int, name: String)
import estrapade.{TestApp, test}
import magnolia.examples.Show
case class RPerson(age: Int, name: String, child: Option[RPerson])
case class GPerson(child: Option[RPerson])
object ShowDerivationTest extends TestApp {
implicit def showForOption[T](implicit ts: Show[String, T]): Show[String, Option[T]] =
new Show[String, Option[T]] {
override def show(value: Option[T]): String = {
import estrapade.TestApp
import magnolia.{CaseClass, Magnolia}
import estrapade.{TestApp, test}
import contextual.data.scalac._
import scala.language.experimental.macros
trait StructureOf[T] {
def structure:Structure
def isOptional = false
}
import cats.data.NonEmptyList
import cats.effect.{ContextShift, IO, Resource, Timer}
import com.typesafe.scalalogging.LazyLogging
import io.circe.{Json, JsonObject}
import org.http4s.circe._
import org.http4s._
import org.http4s.client.Client
import cats.implicits._
import scala.concurrent.ExecutionContext
task regenerateSolc(type:Exec) {
inputs.dir("solidity")
outputs.dir("src/main/java/solidity")
commandLine './regenerate-solidity.sh'
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}