Commit 43141db 1 parent 7193725 commit 43141db Copy full SHA for 43141db
File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,31 @@ RepositoryBasedTest >> testFindAllMatchingLimitedToSortedByAscending [
257
257
258
258
]
259
259
260
+ { #category : ' tests - querying' }
261
+ RepositoryBasedTest >> testFindAllMatchingLimitedToSortedByAscendingLimitGreaterThanNumberOfMatchingElements [
262
+
263
+ | results |
264
+ self extraterrestrials
265
+ store: self silvesterStallone;
266
+ store: self silvesterMcCoy;
267
+ store: self johnTravolta;
268
+ store: self johnLock.
269
+
270
+ results := self extraterrestrials
271
+ findAllMatching: [ :extraterrestrial :criteria |
272
+ criteria does: extraterrestrial lastName asUppercase includeSubstring: ' L' ]
273
+ limitedTo: 4
274
+ sortedByAscending: #lastName .
275
+
276
+ self
277
+ assert: results size equals: 3 ;
278
+ assert: ( results anySatisfy: [ :result | result lastName = ' Lock' ] );
279
+ deny: ( results anySatisfy: [ :result | result lastName = ' McCoy' ] );
280
+ assert: ( results anySatisfy: [ :result | result lastName = ' Stallone' ] );
281
+ assert: ( results anySatisfy: [ :result | result lastName = ' Travolta' ] )
282
+
283
+ ]
284
+
260
285
{ #category : ' tests - querying' }
261
286
RepositoryBasedTest >> testFindAllMatchingSortedBy [
262
287
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ InMemoryRepository >> findAllMatching: aCriteriaOrBlock [
73
73
InMemoryRepository >> findAllMatching: aCriteriaOrBlock limitedTo: aMaxNumberOfResults sortedByAscending: aVariableName [
74
74
75
75
^ ( ( self contentsSortedByAscending: aVariableName ) select:
76
- ( self asMatchingCriteria: aCriteriaOrBlock ) ) copyFirst : aMaxNumberOfResults
76
+ ( self asMatchingCriteria: aCriteriaOrBlock ) ) copyNoMoreThanFirst : aMaxNumberOfResults
77
77
]
78
78
79
79
{ #category : ' querying' }
You can’t perform that action at this time.
0 commit comments