File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,14 +6,14 @@ fn test_utf8_null_dererence() {
66 use std:: ffi:: c_char;
77 use std:: ptr;
88
9+ use AllocResult as R ;
10+
911 unsafe {
1012 let mut output_null: * mut c_char = ptr:: null_mut ( ) ;
1113 let result_null: * const c_char = ptr:: null ( ) ;
1214
1315 let result = to_utf8 ( result_null, & mut output_null) ;
1416
15- use AllocResult as R ;
16-
1717 assert_ne ! ( result, R :: OK ) ;
1818 assert_ne ! ( result, R :: C_STRING_CONVERT_ERR ) ;
1919 assert_eq ! ( result, R :: NULL_DEFERENCE_ERR ) ;
@@ -28,6 +28,8 @@ fn test_utf8() {
2828 use std:: ffi:: { CStr , CString , c_char} ;
2929 use std:: ptr:: null_mut;
3030
31+ use AllocResult as R ;
32+
3133 let mut out: * mut c_char = null_mut ( ) ;
3234 let content = CString :: new (
3335 "café 世界 🌍\n 春の海 ひねもすのたり のたりかな\n شكرا لك.\n
@@ -41,8 +43,6 @@ fn test_utf8() {
4143 let result = to_utf8 ( content. as_ptr ( ) , & mut out) ;
4244 let content_str = CStr :: from_ptr ( out) . to_str ( ) . unwrap ( ) ;
4345
44- use AllocResult as R ;
45-
4646 assert_ne ! ( result, R :: C_STRING_CONVERT_ERR ) ;
4747 assert_ne ! ( result, R :: NULL_DEFERENCE_ERR ) ;
4848 assert_eq ! ( result, R :: OK ) ;
You can’t perform that action at this time.
0 commit comments