Christoph Thiede uploaded a new version of Tests to project The Inbox:
http://source.squeak.org/inbox/Tests-ct.447.mcz==================== Summary ====================
Name: Tests-ct.447
Author: ct
Time: 18 January 2021, 12:55:37.357232 pm
UUID: 675252a4-a6d9-d442-b594-3c85592290a4
Ancestors: Tests-dtl.443
Fixes and supplements BecomeTest.
- Updated #testBecomeForwardIdentityHash which has been broken since Collections-eem.885. Note that the referenced patch to #becomeForward: was a breaking change which we should make sure to document in the final release notes.
- Added #testBecomeForwardIdentityAndHash to have a test for the classical primitiveArrayBecomeOneWay (primitive 72) again.
- Added #testBecomeForwardCopyIdentityHash to test both bindings of the copyHash argument indeed.
Please review! Fur further reference, see
https://github.com/codefrau/SqueakJS/pull/117 where we were discussing the limitations/correctness of the current BecomeTest implementation.
=============== Diff against Tests-dtl.443 ===============
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 hb |
+ a := 'ab' copy.
+ b := 'cd' copy.
+ ha := a identityHash.
+ hb := b identityHash.
+
+ a becomeForward: b copyHash: true.
+
+ self
+ assert: ha equals: a identityHash;
+ assert: ha equals: b identityHash.!
Item was added:
+ ----- Method: BecomeTest>>testBecomeForwardIdentityAndHash (in category 'tests') -----
+ testBecomeForwardIdentityAndHash
+ "Check that
+ 1. the argument to becomeForward: is NOT 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} elementsForwardIdentityAndHashTo: {b}.
+
+ self
+ assert: ha equals: a identityHash;
+ assert: ha equals: b identityHash.!
Item was changed:
----- Method: BecomeTest>>testBecomeForwardIdentityHash (in category 'tests') -----
testBecomeForwardIdentityHash
"Check that
+ 1. the argument to becomeForward: is NOT modified to have the receiver's identity hash.
- 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.
-
- !