[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
broken-test[S8ObjC] array-references
SwikiCodeRobot @> #testS8ObjCArrayReferences |
"Test references"
| pool array object nsarray o2 |
pool := (ObjCClass named: #NSAutoreleasePool in: #Foundation) newInstanceHandle.
array := (ObjCClass named: #NSMutableArray) handle value: #arrayWithCapacity value: 2.
(array value: #count) = 0 ifFalse: [ self error: 'Wrong size (0)' ].
array value: #addObject value: (ObjCClass named: #NSArray) handle.
(array value: #count) = 1 ifFalse: [ self error: 'Wrong size (1)' ].
object := (ObjCClass named: #NSObject) newInstanceHandle.
array value: #addObject value: object.
(array value: #count) = 2 ifFalse: [ self error: 'Wrong size (2)' ].
nsarray := ID @ (array value: #objectAtIndex value: 0).
nsarray pointer address = (ObjCClass named: #NSArray) pointer address
ifFalse: [ self error: 'Wrong address' ].
o2 := ID @ (array value: #objectAtIndex value: 1).
o2 pointer address = (ID @ object) pointer address ifFalse: [ self error: 'Wrong object address' ].
Smalltalk gc.
self print: #done