module string_ffi_ref_test
-intrude import string
+intrude import text::flat
import file
class StringTest
- var copied_str: nullable String
+ var copied_str: nullable String = null
- var referenced_str: nullable String
-
- init
- do
- copied_str = null
- referenced_str = null
- end
+ var referenced_str: nullable String = null
fun get_c_string import FlatString.items, NativeString.to_s, NativeString.to_s_with_copy, StringTest.ref_test, StringTest.copy_test `{
char* string = "This is a test string";
FlatString ref_string = NativeString_to_s(string);
- StringTest_ref_test(recv, ref_string);
+ StringTest_ref_test(self, ref_string);
FlatString copy_string = NativeString_to_s_with_copy(string);
- StringTest_copy_test(recv, copy_string);
+ StringTest_copy_test(self, copy_string);
int same_refs = FlatString_items(copy_string) == FlatString_items(ref_string);