Skip to content

Commit 107ca28

Browse files
committed
test(EnumHint): test gto_godot_hint_string
1 parent 5b3da95 commit 107ca28

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

gdnative-core/src/export/property/hint.rs

+10
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,13 @@ impl ArrayHint {
471471
}
472472
}
473473
}
474+
475+
godot_test!(test_enum_hint_without_mapping {
476+
let hint = EnumHint::new(vec!["Foo".into(), "Bar".into()]);
477+
assert_eq!(hint.to_godot_hint_string().to_string(), "Foo,Bar".to_string(),);
478+
});
479+
480+
godot_test!(test_enum_hint_with_mapping {
481+
let hint = EnumHint::with_numbers(vec![("Foo".into(), 42), ("Bar".into(), 67)]);
482+
assert_eq!(hint.to_godot_hint_string().to_string(), "Foo:42,Bar:67".to_string(),);
483+
});

test/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ pub extern "C" fn run_tests(
6767
status &= gdnative::core_types::test_vector3_array_debug();
6868
status &= gdnative::core_types::test_transform2d_behavior();
6969

70+
status &= gdnative::export::hint::test_enum_hint_without_mapping();
71+
status &= gdnative::export::hint::test_enum_hint_with_mapping();
72+
7073
status &= test_underscore_method_binding();
7174
status &= test_rust_class_construction();
7275
status &= test_from_instance_id();

0 commit comments

Comments
 (0)