Skip to content

Commit d464e63

Browse files
committed
test(EnumHint): test gto_godot_hint_string
1 parent 89cbefc commit d464e63

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,13 @@ impl ArrayHint {
479479
}
480480
}
481481
}
482+
483+
godot_test!(test_enum_hint_without_mapping {
484+
let hint = EnumHint::new(vec!["Foo".into(), "Bar".into()]);
485+
assert_eq!(hint.to_godot_hint_string().to_string(), "Foo,Bar".to_string(),);
486+
});
487+
488+
godot_test!(test_enum_hint_with_mapping {
489+
let hint = EnumHint::with_numbers(vec![("Foo".into(), 42), ("Bar".into(), 67)]);
490+
assert_eq!(hint.to_godot_hint_string().to_string(), "Foo:42,Bar:67".to_string(),);
491+
});

test/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ pub extern "C" fn run_tests(
2828

2929
status &= gdnative::core_types::test_core_types();
3030

31+
status &= gdnative::export::hint::test_enum_hint_without_mapping();
32+
status &= gdnative::export::hint::test_enum_hint_with_mapping();
33+
34+
status &= test_underscore_method_binding();
35+
status &= test_rust_class_construction();
3136
status &= test_from_instance_id();
3237
status &= test_nil_object_return_value();
3338
status &= test_rust_class_construction();

0 commit comments

Comments
 (0)