Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit 2cc2155

Browse files
committed
Additional tests
1 parent e00c2ff commit 2cc2155

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/test/scala/scala/tools/refactoring/tests/implementations/ImplementMethodsTest.scala

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,36 @@ class ImplementMethodsTest extends TestHelper with TestRefactoring {
5050
""".stripMargin
5151
} applyRefactoring implementMethods
5252

53+
@Test
54+
def implementMethodFromExtendedClass() = new FileSet() {
55+
"""
56+
|package implementMethods
57+
|
58+
|abstract class C {
59+
| def f(x: Int): String
60+
|}
61+
|
62+
|object Obj extends /*(*/C/*)*/ {
63+
| val x: Int = ???
64+
|}
65+
""".stripMargin becomes
66+
"""
67+
|package implementMethods
68+
|
69+
|abstract class C {
70+
| def f(x: Int): String
71+
|}
72+
|
73+
|object Obj extends /*(*/C/*)*/ {
74+
| val x: Int = ???
75+
|
76+
| def f(x: Int): String = {
77+
| ???
78+
| }
79+
|}
80+
""".stripMargin
81+
} applyRefactoring implementMethods
82+
5383
@Test
5484
def implementMethodFromSecondMixing() = new FileSet() {
5585
"""
@@ -63,7 +93,7 @@ class ImplementMethodsTest extends TestHelper with TestRefactoring {
6393
| def g(x: Int): Int
6494
|}
6595
|
66-
|object Obj extends T with /*(*/S/*)*/ {
96+
|class C extends T with /*(*/S/*)*/ {
6797
| val x: Int = ???
6898
|}
6999
""".stripMargin becomes
@@ -78,7 +108,7 @@ class ImplementMethodsTest extends TestHelper with TestRefactoring {
78108
| def g(x: Int): Int
79109
|}
80110
|
81-
|object Obj extends T with /*(*/S/*)*/ {
111+
|class C extends T with /*(*/S/*)*/ {
82112
| val x: Int = ???
83113
|
84114
| def g(x: Int): Int = {

0 commit comments

Comments
 (0)