[squeak-dev] The Trunk: CollectionsTests-nice.258.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Wed Nov 11 01:26:02 UTC 2015
I think this was the first time I saw #in:
There are still a few senders, so someone else might discover the pattern
despite this removal...
A good point of #in: usage here was to make it clear that we were kind of
inlining a method per se.
2015-11-11 2:13 GMT+01:00 <commits at source.squeak.org>:
> 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.
> !
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20151111/e0090bf2/attachment.htm
More information about the Squeak-dev
mailing list
|