File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
codegen/src/main/scala/overflowdb/codegen
integration-tests/tests/src/test/scala Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -1674,8 +1674,8 @@ class CodeGen(schema: Schema) {
1674
1674
}
1675
1675
}.mkString(" \n " )
1676
1676
1677
- val copyPropertiesImpl = properties .map { property =>
1678
- val memberName = camelCase(property .name)
1677
+ val copyFieldsImpl = fieldDescriptions .map { field =>
1678
+ val memberName = field .name
1679
1679
s " newInstance. $memberName = this. $memberName"
1680
1680
}.mkString(" \n " )
1681
1681
@@ -1697,7 +1697,7 @@ class CodeGen(schema: Schema) {
1697
1697
|
1698
1698
| override def copy: this.type = {
1699
1699
| val newInstance = new New $nodeClassName
1700
- | $copyPropertiesImpl
1700
+ | $copyFieldsImpl
1701
1701
| newInstance.asInstanceOf[this.type]
1702
1702
| }
1703
1703
|
Original file line number Diff line number Diff line change @@ -168,4 +168,21 @@ class Schema04Test extends AnyWordSpec with Matchers {
168
168
node1.intList shouldBe IndexedSeq (1 ,2 ,3 )
169
169
edge1.intList shouldBe IndexedSeq (3 ,4 ,5 )
170
170
}
171
+
172
+ " NewNode.copy includes contained nodes" in {
173
+ val node1 = NewNode1 ()
174
+ .bool(true )
175
+ .str(" foo" )
176
+ .intList(Seq (1 ,2 ,3 ): Seq [Integer ])
177
+
178
+ val node2 = NewNode1 ().node1Inner(node1)
179
+
180
+ val node1Copy = node1.copy
181
+ node1Copy.bool shouldBe true
182
+ node1Copy.str shouldBe " foo"
183
+ node1Copy.intList shouldBe Seq (1 ,2 ,3 )
184
+
185
+ val node2Copy = node2.copy
186
+ node2Copy.node1Inner shouldBe node1
187
+ }
171
188
}
You can’t perform that action at this time.
0 commit comments