Skip to content

Commit 0389e2d

Browse files
committed
Test: Add deep copy state isolation test
1 parent d947902 commit 0389e2d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/Containers-KeyedTree-Tests/CTKeyedTreeTest.class.st

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,25 @@ CTKeyedTreeTest >> testCopy [
215215
self assert: (c includesKey: #new)
216216
]
217217

218+
{ #category : 'tests' }
219+
CTKeyedTreeTest >> testDeepCopyStateNotShared [
220+
| original clone |
221+
original := CTKeyedTree new
222+
at: #config put: (CTKeyedTree new
223+
at: #color put: 'red';
224+
yourself);
225+
yourself.
226+
227+
clone := original copy.
228+
229+
(clone at: #config) at: #color put: 'blue'.
230+
231+
self assert: (original atPath: #(config color)) equals: 'red'.
232+
self assert: (clone atPath: #(config color)) equals: 'blue'.
233+
234+
self deny: (original at: #config) == (clone at: #config).
235+
]
236+
218237
{ #category : 'tests' }
219238
CTKeyedTreeTest >> testDepth [
220239

0 commit comments

Comments
 (0)