Skip to content

Commit 29b1d3f

Browse files
authored
Merge pull request #1 from targrub/Test-Duration-rather-than-std-version
Test serialization of Bevy's `Duration`, not `std::time::Duration`.
2 parents 29ebbd9 + 807fbcf commit 29b1d3f

File tree

1 file changed

+7
-5
lines changed
  • crates/bevy_reflect/src/impls

1 file changed

+7
-5
lines changed

crates/bevy_reflect/src/impls/std.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use crate::{
99

1010
use crate::utility::{GenericTypeInfoCell, NonGenericTypeInfoCell};
1111
use bevy_reflect_derive::{impl_from_reflect_value, impl_reflect_value};
12-
use bevy_utils::{Duration, HashMap, HashSet, Instant};
12+
use bevy_utils::{Duration, Instant};
13+
use bevy_utils::{HashMap, HashSet};
1314
use std::{
1415
any::Any,
1516
borrow::Cow,
@@ -889,18 +890,19 @@ mod tests {
889890
Enum, FromReflect, Reflect, ReflectSerialize, TypeInfo, TypeRegistry, Typed, VariantInfo,
890891
VariantType,
891892
};
892-
use bevy_utils::{HashMap, Instant};
893+
use bevy_utils::HashMap;
894+
use bevy_utils::{Duration, Instant};
893895
use std::f32::consts::{PI, TAU};
894896

895897
#[test]
896898
fn can_serialize_duration() {
897899
let mut type_registry = TypeRegistry::default();
898-
type_registry.register::<std::time::Duration>();
900+
type_registry.register::<Duration>();
899901

900902
let reflect_serialize = type_registry
901-
.get_type_data::<ReflectSerialize>(std::any::TypeId::of::<std::time::Duration>())
903+
.get_type_data::<ReflectSerialize>(std::any::TypeId::of::<Duration>())
902904
.unwrap();
903-
let _serializable = reflect_serialize.get_serializable(&std::time::Duration::ZERO);
905+
let _serializable = reflect_serialize.get_serializable(&Duration::ZERO);
904906
}
905907

906908
#[test]

0 commit comments

Comments
 (0)