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

test[S8ObjC] nsString

SwikiCodeRobot @> #testS8ObjCNsString

"nsString length"
| str nsStr |
str := #hello.
nsStr := (ObjCClass named: #NSString) handle
	value: #stringWithUTF8String
	value: str.
(nsStr value: #length) = str size ifFalse: [
	self error: 'Wrong length'
].
#ok 


"nsString toString"
| str nsStr |
str := #hello.
nsStr := (ObjCClass named: #NSString) handle
	value: #stringWithUTF8String
	value: str.
nsStr toString = str ifFalse: [
	self error: 'Wrong contents'
].
#ok 


"nsString concat"
| str nsStr |
str := #hello.
nsStr := (ObjCClass named: #NSString) handle
	value: #stringWithUTF8String
	value: str.
self error: 'broken test - crash in next message send'.
nsStr := nsStr
	value: #stringByAppendingString
	value: nsStr.
str ,str = nsStr toString ifFalse: [
	self error: 'Wrong append'
].
#ok