From f033787d7c87f2482036f163c9fab5da013cdc4b Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Tue, 28 May 2024 10:02:48 -0400 Subject: [PATCH] Add test that traits are not sealed --- tests/tests.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/tests.rs b/tests/tests.rs index 80f19a5..f2b6a19 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -545,3 +545,31 @@ fn test_emoji_zwj() { 3, ); } + +// Test traits are unsealed + +#[cfg(feature = "cjk")] +#[allow(dead_code)] +struct Foo; + +#[cfg(feature = "cjk")] +impl UnicodeWidthChar for Foo { + fn width(self) -> Option { + Some(0) + } + + fn width_cjk(self) -> Option { + Some(0) + } +} + +#[cfg(feature = "cjk")] +impl UnicodeWidthStr for Foo { + fn width(&self) -> usize { + 0 + } + + fn width_cjk(&self) -> usize { + 0 + } +}