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

test[S8FFI] library async

SwikiCodeRobot @> #testS8FFILibraryAsync

"should call a function asynchronously"
| name result |
name := NodeJS process platform = #win32 ifTrue:  [ #msvcrt  ] ifFalse: [ #libm ].
result := S8FFI current library: name functions: (#ceil -> (Array with: #double with: #(#double) with: #async -> true) ) lib: nil.
result isNil ifTrue: [ self error: 'Library missing' ].
(result handle #ceil: 1.1 with: [:err :res|
	err notNil ifTrue: [ self error: err ].
	res = 2 ifFalse: [ self error: 'Invalid result' ]
]).