Skip to content

Commit

Permalink
Merge pull request #1 from targrub/Test-Duration-rather-than-std-version
Browse files Browse the repository at this point in the history
Test serialization of Bevy's `Duration`, not `std::time::Duration`.
  • Loading branch information
targrub authored Sep 20, 2022
2 parents 29ebbd9 + 807fbcf commit 29b1d3f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions crates/bevy_reflect/src/impls/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use crate::{

use crate::utility::{GenericTypeInfoCell, NonGenericTypeInfoCell};
use bevy_reflect_derive::{impl_from_reflect_value, impl_reflect_value};
use bevy_utils::{Duration, HashMap, HashSet, Instant};
use bevy_utils::{Duration, Instant};
use bevy_utils::{HashMap, HashSet};
use std::{
any::Any,
borrow::Cow,
Expand Down Expand Up @@ -889,18 +890,19 @@ mod tests {
Enum, FromReflect, Reflect, ReflectSerialize, TypeInfo, TypeRegistry, Typed, VariantInfo,
VariantType,
};
use bevy_utils::{HashMap, Instant};
use bevy_utils::HashMap;
use bevy_utils::{Duration, Instant};
use std::f32::consts::{PI, TAU};

#[test]
fn can_serialize_duration() {
let mut type_registry = TypeRegistry::default();
type_registry.register::<std::time::Duration>();
type_registry.register::<Duration>();

let reflect_serialize = type_registry
.get_type_data::<ReflectSerialize>(std::any::TypeId::of::<std::time::Duration>())
.get_type_data::<ReflectSerialize>(std::any::TypeId::of::<Duration>())
.unwrap();
let _serializable = reflect_serialize.get_serializable(&std::time::Duration::ZERO);
let _serializable = reflect_serialize.get_serializable(&Duration::ZERO);
}

#[test]
Expand Down

0 comments on commit 29b1d3f

Please sign in to comment.