[squeak-dev] The Trunk: Tests-nice.458.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Apr 28 16:12:10 UTC 2021
Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.458.mcz
==================== Summary ====================
Name: Tests-nice.458
Author: nice
Time: 28 April 2021, 6:11:51.033213 pm
UUID: 13fec56a-805e-754e-bd02-8cbaa015e102
Ancestors: Tests-jr.457
Document the fact that becomeForward: does NOT forward identityHash of receiver anymore (since Collections-eem.885 April 2020)
See #elementsForwardIdentityTo: vs #elementsForwardIdentityAndHashTo:
See also http://forum.world.st/How-to-become-immediate-objects-td5114931.html
=============== Diff against Tests-jr.457 ===============
Item was changed:
----- Method: BecomeTest>>testBecomeForward (in category 'tests') -----
testBecomeForward
"Test the forward become."
| a b c d |
a := 'ab' copy.
b := 'cd' copy.
+ c := Array with: a.
- c := a.
d := b.
a becomeForward: b.
self
assert: a = 'cd';
assert: b = 'cd';
+ assert: a == b;
+ assert: c first == b;
+ assert: d == b.
- assert: c = 'cd';
- assert: d = 'cd'.
-
!
Item was added:
+ ----- Method: BecomeTest>>testBecomeForwardCopyIdentityHash (in category 'tests') -----
+ testBecomeForwardCopyIdentityHash
+ "Check that
+ 1. the argument to becomeForward: is modified to have the receiver's identity hash.
+ 2. the receiver's identity hash is unchanged."
+
+ | a b ha |
+
+ a := 'ab' copy.
+ b := 'cd' copy.
+ ha := a identityHash.
+
+ a becomeForward: b copyHash: true.
+
+ self
+ assert: a identityHash = ha;
+ assert: b identityHash = ha.
+
+ !
Item was changed:
----- Method: BecomeTest>>testBecomeForwardDontCopyIdentityHash (in category 'tests') -----
testBecomeForwardDontCopyIdentityHash
"Check that
1. the argument to becomeForward: is NOT modified to have the receiver's identity hash.
+ 2. the receiver's identity hash is changed."
- 2. the receiver's identity hash is unchanged."
| a b hb |
a := 'ab' copy.
b := 'cd' copy.
hb := b identityHash.
a becomeForward: b copyHash: false.
self
assert: a identityHash = hb;
assert: b identityHash = hb.
!
Item was changed:
----- Method: BecomeTest>>testBecomeForwardIdentityHash (in category 'tests') -----
testBecomeForwardIdentityHash
+ "Document that the receiver hash is changed, but the argument hash is unchanged.
+ (a becomeForward: b) has thus same effect as (a becomeForward: b copyHash: false)"
- "Check that
- 1. the argument to becomeForward: is modified to have the receiver's identity hash.
- 2. the receiver's identity hash is unchanged."
+ | a b hb |
- | a b ha |
a := 'ab' copy.
b := 'cd' copy.
+ hb := b identityHash.
- ha := a identityHash.
a becomeForward: b.
self
+ assert: a identityHash = hb;
+ assert: b identityHash = hb.
- assert: a identityHash = ha;
- assert: b identityHash = ha.
!
More information about the Squeak-dev
mailing list
|