File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
src/Containers-Stack-Tests Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,22 @@ CTStackTest >> testCopyHasSameContents [
9797 self assert: copy top equals: stack top
9898]
9999
100+ { #category : ' tests' }
101+ CTStackTest >> testCopyIsIndependent [
102+
103+ | copy |
104+ stack push: ' a' ; push: ' b' .
105+ copy := stack copy.
106+
107+ " Now, modify the original stack"
108+ stack pop.
109+ stack push: ' c' .
110+
111+ self assert: copy size equals: 2 .
112+ self assert: copy top equals: ' b' .
113+ self deny: copy top equals: stack top.
114+ ]
115+
100116{ #category : ' tests' }
101117CTStackTest >> testDefaultStackCreation [
102118
@@ -273,7 +289,7 @@ CTStackTest >> testPushSingleElement [
273289 self assert: stack top equals: ' first'
274290]
275291
276- { #category : ' removing ' }
292+ { #category : ' tests ' }
277293CTStackTest >> testRemoveAll [
278294
279295 stack
@@ -283,7 +299,12 @@ CTStackTest >> testRemoveAll [
283299 stack removeAll.
284300
285301 self assert: stack isEmpty.
286- self assert: stack size equals: 0
302+ self assert: stack size equals: 0 .
303+
304+ stack push: ' d' .
305+ self deny: stack isEmpty.
306+ self assert: stack size equals: 1 .
307+ self assert: stack top equals: ' d' .
287308]
288309
289310{ #category : ' tests' }
You can’t perform that action at this time.
0 commit comments