[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

broken-test[S8ObjC] 015 instantiating Arrays

SwikiCodeRobot @> #testS8ObjCInstantiatingArrays

"Create a NSArray, get ancestors and methods"
| cls array |
cls := ObjCClass named: #NSMutableArray.
array := ID @ cls newInstanceHandle.
self print: 'ancestors=',array ancestors printString.
self print: 'methods=',array methods asLiteral.
Smalltalk gc.


"Create a NSArray and add an element"
| cls array hello |
cls := ObjCClass named: #NSMutableArray.

self error: 'Instantiation of NSMutableArray actually broken'.

array := ID @ cls newInstanceHandle.
hello := S8ObjC value: 'Hello world'.
array handle value: #addObject value: hello.
array handle value: #addObject value: hello.
self print: array.