From e227be8f1ea411ca6b5ac2dac3346450a75a1524 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 4 Dec 2023 17:54:50 +0100 Subject: [PATCH] Add integration test --- tests/bound.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/bound.rs b/tests/bound.rs index c95fc03..8139822 100644 --- a/tests/bound.rs +++ b/tests/bound.rs @@ -4,7 +4,22 @@ use std::marker::PhantomData; use derive_where::derive_where; -use self::util::AssertClone; +use self::util::{AssertClone, AssertCopy}; + +#[test] +fn bound() { + #[derive_where(Clone, Copy; T)] + struct Test(T, std::marker::PhantomData); + + let test_1 = Test(42, PhantomData::<()>); + + let _ = AssertClone(&test_1); + let _ = AssertCopy(&test_1); + + #[allow(clippy::clone_on_copy)] + let test_clone = test_1.clone(); + assert_eq!(test_clone.0, 42); +} #[test] fn custom_generic() {