Skip to content

Commit

Permalink
add test that T<A> and T<B> have the same type uuid if A::TYPE_UUID=B…
Browse files Browse the repository at this point in the history
…::TYPE_UUID
  • Loading branch information
jakobhellermann committed Mar 14, 2022
1 parent 51279fb commit d9ee1f4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/bevy_reflect/src/type_uuid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,20 @@ mod test {
assert_ne!(uuid_ab, TestDeriveStructA::<Inner>::TYPE_UUID);
assert_ne!(uuid_ba, TestDeriveStructB::<Inner>::TYPE_UUID);
}

#[test]
fn test_generic_type_uuid_same_for_eq_param() {
#[derive(TypeUuid, Clone)]
#[uuid = "49951b1c-4811-45e7-acc6-3119249fbd8f"]
struct A;

#[derive(TypeUuid, Clone)]
#[uuid = "49951b1c-4811-45e7-acc6-3119249fbd8f"]
struct BButSameAsA;

let uuid_a = TestDeriveStruct::<A>::TYPE_UUID;
let uuid_b = TestDeriveStruct::<BButSameAsA>::TYPE_UUID;

assert_eq!(uuid_a, uuid_b);
}
}

0 comments on commit d9ee1f4

Please sign in to comment.