Merge: tests: Test result update for `curl_http`
[nit.git] / tests / string_ffi_ref_test.nit
index 2f8e168..56461e1 100644 (file)
 
 module string_ffi_ref_test
 
-class StringTest
+intrude import text::flat
+import file
 
-       var copied_str: nullable String
+class StringTest
 
-       var referenced_str: nullable String
+       var copied_str: nullable String = null
 
-       init
-       do
-               copied_str = null
-               referenced_str = null
-       end
+       var referenced_str: nullable String = null
 
-       fun get_c_string import String.items, NativeString.to_s, NativeString.to_s_with_copy, StringTest.ref_test, StringTest.copy_test `{
+       fun get_c_string import FlatString.items, CString.to_s, CString.to_s, StringTest.ref_test, StringTest.copy_test `{
                char* string = "This is a test string";
 
-               String ref_string = NativeString_to_s(string);
-               StringTest_ref_test(recv, ref_string);
+               FlatString ref_string = CString_to_s(string);
+               StringTest_ref_test(self, ref_string);
 
-               String copy_string = NativeString_to_s_with_copy(string);
-               StringTest_copy_test(recv, copy_string);
+               FlatString copy_string = CString_to_s(string);
+               StringTest_copy_test(self, copy_string);
 
-               int same_refs = String_items(copy_string) == String_items(ref_string);
+               int same_refs = FlatString_items(copy_string) == FlatString_items(ref_string);
 
-               printf("Do the strings have the same NativeString reference ? ");
+               printf("Do the strings have the same CString reference ? ");
 
                if(same_refs){
                        printf("True\n");