[squeak-dev] The Trunk: CollectionsTests-nice.258.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Nov 11 01:13:30 UTC 2015
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.258.mcz
==================== Summary ====================
Name: CollectionsTests-nice.258
Author: nice
Time: 11 November 2015, 2:13:17.734 am
UUID: ae069e82-965d-43ce-85ff-82cc44b73d48
Ancestors: CollectionsTests-ul.257
Use fresh new withoutPrimitive utility, and let one more test pass in Spur.
=============== Diff against CollectionsTests-ul.257 ===============
Item was changed:
----- Method: StringTest>>testFindSubstringInStartingAtMatchTable (in category 'tests - finding') -----
testFindSubstringInStartingAtMatchTable
| str tbl cm |
str := 'hello '.
tbl := String classPool at: #CaseSensitiveOrder.
self assert: (str findSubstring: ' ' in: str startingAt: 1 matchTable: tbl) = 6.
self assert: (str findSubstring: 'q' in: str startingAt: 1 matchTable: tbl) = 0.
self assert: (str findSubstring: 'q' in: str startingAt: -1 matchTable: tbl) = 0.
self assert: (str findSubstring: ' ' in: str startingAt: -1 matchTable: tbl) = 6.
"The next test ensures that the fallback code works just as well"
+ cm := (ByteString >> #findSubstring:in:startingAt:matchTable:) withoutPrimitive.
- cm := (ByteString >> #findSubstring:in:startingAt:matchTable:) in: [:origMethod |
- "Adapted from CompiledMethod>>#newFrom: "
- | inst header|
- header := origMethod header bitAnd: 16r1FF bitInvert.
- "CompiledMethod newFrom: CompiledMethod class >> #newFrom:"
- inst := CompiledMethod
- newMethod: origMethod basicSize - origMethod initialPC + 1
- header: header.
- 1 to: origMethod numLiterals do: [:index| inst literalAt: index put: (origMethod literalAt: index)].
- origMethod initialPC to: origMethod size do: [:index | inst at: index put: (origMethod at: index)].
- inst postCopy].
self assert: (cm valueWithReceiver: str arguments: {' '. str. 1. tbl}) = 6.
self assert: (cm valueWithReceiver: str arguments: {'q'. str. 1. tbl}) = 0.
self assert: (cm valueWithReceiver: str arguments: {'q'. str. -1. tbl}) = 0.
self assert: (cm valueWithReceiver: str arguments: {' '. str. -1. tbl}) = 6.
!
More information about the Squeak-dev
mailing list
|