Add test for global variables
This commit is contained in:
parent
12b7661295
commit
4c60ff5085
2 changed files with 6 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ CString upcall_test(StringFactory fun) {
|
|||
return fun();
|
||||
}
|
||||
|
||||
static int counter = 0;
|
||||
int counter = 0;
|
||||
|
||||
static char* responses[] = { "Hello, world!", "Goodbye friend.", "co'oi prenu" };
|
||||
|
||||
|
|
|
|||
|
|
@ -44,3 +44,8 @@
|
|||
{:a \x
|
||||
:x 3.14
|
||||
:y 42.0})))
|
||||
|
||||
(t/deftest static-variables-are-mutable
|
||||
(ffi/freset! (ffi/static-variable "counter" ::mem/int) 1)
|
||||
(t/is (= ((ffi/cfn "get_string1" [] ::mem/c-string))
|
||||
"Goodbye friend.")))
|
||||
|
|
|
|||
Loading…
Reference in a new issue