Skip to content

Commit 4088200

Browse files
committed
update
1 parent 393422e commit 4088200

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ImplicitAndQualifiedthisUnitTest {
99
@Test
1010
fun `Qualified this and implicit this Test`() {
1111

12+
1213
fun printLine() = "Top-level function"
1314
val x = 5
1415

@@ -23,8 +24,8 @@ class ImplicitAndQualifiedthisUnitTest {
2324
val b = this // Implicit: refers to the current instance of Outer
2425
assertEquals(Outer::class.java.name, b::class.java.name)
2526

26-
assertEquals(1, this.x + 1) // Implicit: refers to the x property of the current Outer instance
27-
assertEquals(6, x + 1) // Implicit: refers to the x property of the current Outer instance
27+
assertEquals(0, this.x) // Implicit: refers to the x property of the current Outer instance
28+
assertEquals(5, x) // Implicit: refers to the x property of the current Outer instance
2829

2930
assertEquals("Member function", this.printLine())
3031
assertEquals("Top-level function", printLine())

0 commit comments

Comments
 (0)