A new version of CollectionsTests was added to project The Inbox:
http://source.squeak.org/inbox/CollectionsTests-EG.342.mcz==================== Summary ====================
Name: CollectionsTests-EG.342
Author: EG
Time: 7 August 2020, 8:18:24.376363 pm
UUID: cd08c4bb-0a50-4a33-9fd1-96876f07f3e0
Ancestors: CollectionsTests-ul.341
Adding tests for the updated #peekBack behavior
=============== Diff against CollectionsTests-ul.341 ===============
Item was added:
+ ----- Method: ReadStreamTest>>testPeekBack (in category 'tests - back') -----
+ testPeekBack
+ "Test the ability to peek backwards on the stream"
+ | stream |
+ stream := ReadStream on: 'abcd'.
+ stream skip: 2.
+ self assert: $b equals: stream peekBack!
Item was added:
+ ----- Method: ReadStreamTest>>testPeekBackOnPosition1 (in category 'tests - back') -----
+ testPeekBackOnPosition1
+ "Ensure that #peekBack works from position 1,
+ giving us the first element in the stream"
+ | stream |
+ stream := ReadStream on: 'abcde'.
+ stream skip: 1.
+ self assert: $a equals: stream peekBack!
Item was added:
+ ----- Method: ReadStreamTest>>testPeekBackOnPositionZero (in category 'tests - back') -----
+ testPeekBackOnPositionZero
+ "Ensure that we *cannot* peekBack on a stream
+ that is currently at the start (zero) position"
+ | stream |
+ stream := ReadStream on: 'abcd'.
+ self
+ should: [ stream peekBack ]
+ raise: Error!