File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -173,19 +173,10 @@ mod tests {
173173
174174 #[ test]
175175 fn test_invalid_enum_handling ( ) {
176- // Test with invalid network value
177- // Since we can't safely create an invalid enum in Rust, we'll test the C API
178- // by calling it with a raw value that doesn't correspond to any valid variant
176+ // Use a valid enum value to avoid UB in Rust tests. If invalid raw inputs
177+ // need to be tested, do so from a C test or add a raw-int FFI entrypoint.
179178 unsafe {
180- // dash_spv_ffi_config_new expects FFINetwork but we'll cast an invalid i32
181- // This simulates what could happen from C code
182- let config = {
183- extern "C" {
184- fn dash_spv_ffi_config_new ( network : i32 ) -> * mut std:: ffi:: c_void ;
185- }
186- dash_spv_ffi_config_new ( 999 ) as * mut FFIClientConfig
187- } ;
188- // Should still create a config (defaults to Dash)
179+ let config = dash_spv_ffi_config_new ( FFINetwork :: Dash ) ;
189180 assert ! ( !config. is_null( ) ) ;
190181 dash_spv_ffi_config_destroy ( config) ;
191182 }
You can’t perform that action at this time.
0 commit comments