Skip to content

Commit a34c90e

Browse files
committed
Fix #209: Add regression test
1 parent a98b901 commit a34c90e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/run/i209.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
case class Foo(a: Int) {
2+
def copy(i: Int = 9): Foo = Foo(i)
3+
}
4+
5+
case class Bar(a: Int, b: Int) {
6+
def copy(i: Int = 4, j: Int = 6): Bar = Bar(i, j)
7+
}
8+
9+
object Test {
10+
def main(args: Array[String]): Unit = {
11+
val a = Foo(2)
12+
assert(a == Foo(2))
13+
assert(a.copy(5) == Foo(5))
14+
assert(a.copy() == Foo(9))
15+
16+
val b = Bar(2, 3)
17+
assert(b == Bar(2, 3))
18+
assert(b.copy(5, 7) == Bar(5, 7))
19+
assert(b.copy(5) == Bar(5, 6))
20+
assert(b.copy(j = 5) == Bar(4, 5))
21+
assert(b.copy() == Bar(4, 6))
22+
}
23+
}

0 commit comments

Comments
 (0)