Skip to content

Commit 76887c7

Browse files
committed
some update after review
1 parent 4088200 commit 76887c7

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

core-kotlin-modules/core-kotlin-lang-oop-3/src/test/kotlin/com/baeldung/implicitAndQualifiedthis/ImplicitAndQualifiedthisUnitTest.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,31 @@ class ImplicitAndQualifiedthisUnitTest {
6161
}
6262
}
6363

64+
val number = 10
65+
66+
number.run {
67+
val numberLambda = { _: String ->
68+
assertEquals(number, this)
69+
}
70+
numberLambda("numberLambda")
71+
}
72+
73+
val someObject = object {
74+
val name = "John"
75+
val age = 30
76+
}
77+
78+
someObject.run {
79+
assertEquals(someObject, this)
80+
81+
val someLambda = { _: String ->
82+
assertEquals(someObject, this)
83+
assertEquals(30, this.age)
84+
assertEquals("John", this.name)
85+
}
86+
87+
someLambda("someLambda")
88+
}
6489
}
6590

6691
fun Int.foo() {

0 commit comments

Comments
 (0)