OndrejMalek / toKotlin

Serialize objects to String as kotlin source code. Make your test doubles without manually rewriting toString() output to kotlin code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Work in progress

toKotlin() like toString() but returns kotlin code as String

Example:

arrayOf(1,2,3).toKotlin() == "arrayOf(1, 2, 3)"
arrayOf<Int>().toKotlin() == "arrayOf<Int>()"

Purpose of this is to create test doubles easily. Uses generics reflection with reified. Is extension function. Meant as development tool.

Implemented

Arrays, Lists, Maps, Sets

TODO

  • Data classes
  • Functions
  • Lambdas ( probably not possible without parsing all codebase )

About

Serialize objects to String as kotlin source code. Make your test doubles without manually rewriting toString() output to kotlin code.

License:Apache License 2.0


Languages

Language:Kotlin 100.0%