Skip to content

Commit

Permalink
Add test that traits are not sealed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-Bertholet committed May 28, 2024
1 parent 9b940f6 commit f033787
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
Some(0)
}

fn width_cjk(self) -> Option<usize> {
Some(0)
}
}

#[cfg(feature = "cjk")]
impl UnicodeWidthStr for Foo {
fn width(&self) -> usize {
0
}

fn width_cjk(&self) -> usize {
0
}
}

0 comments on commit f033787

Please sign in to comment.