-
-
Notifications
You must be signed in to change notification settings - Fork 261
Closed as not planned
Closed as not planned
Copy link
Labels
status: duplicateThis issue or pull request already existsThis issue or pull request already exists
Description
While writing tests for the collections_to_variant PR, this test failed:
let wrong_slice_type = &[
50,
-10,
];
let err = wrong_slice_type
.to_variant()
.try_to::<Array<u32>>()
.expect_err("should have wrongly typed slice");The test panics at the last line .expect_err("should have wrongly typed slice") with the message:
-- rust_to_array_invalid ... [50ERROR: Rust function panicked at godot-core\src\meta\godot_convert\mod.rs:95.
Context: itest `rust_to_array_invalid` failed
at: godot_core::private::handle_panic_with_print (godot-core\src\private.rs:369)
ERROR: [panic] FromGodot::from_variant() failed: `u32` cannot store the given value: -10
at: godot_core::private::handle_panic_with_print (godot-core\src\private.rs:382)
Despite the slice having signed integers, Array::<u32>::try_from_variant is returning Ok, with signed integers inside.
If instead of expect_err, I unwrap then print:
let invalid_array= wrong_slice_type
.to_variant()
.try_to::<Array<u32>>()
.unwrap();
print!("{invalid_array}");It panics on print! since the fmt implementation assumes that the array only has unsigned integers.
Metadata
Metadata
Assignees
Labels
status: duplicateThis issue or pull request already existsThis issue or pull request already exists