[Tests] Test samples from KEEP
This commit is contained in:
committed by
TeamCityServer
parent
b0a7be72e8
commit
d8faa9686d
+24
@@ -0,0 +1,24 @@
|
||||
class JSONObject {
|
||||
fun build(): JSONObject = TODO()
|
||||
|
||||
fun put(key: String, any: Any): Unit = TODO()
|
||||
}
|
||||
|
||||
fun json(build: JSONObject.() -> Unit) = JSONObject().apply { build() }
|
||||
|
||||
context(JSONObject)
|
||||
infix fun String.by(build: JSONObject.() -> Unit) = put(this, JSONObject().build())
|
||||
|
||||
context(JSONObject)
|
||||
infix fun String.by(value: Any) = put(this, value)
|
||||
|
||||
fun test() {
|
||||
val json = json {
|
||||
"name" by "Kotlin"
|
||||
"age" by 10
|
||||
"creator" by {
|
||||
"name" by "JetBrains"
|
||||
"age" by "21"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user