From 94848668f06c9e2c9802e87e2d9bd472914ade98 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Fri, 19 Jul 2019 11:40:15 -0400 Subject: Add more non-ascii tests --- src/edits.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/edits.rs') diff --git a/src/edits.rs b/src/edits.rs index 9e4fea08..18addb08 100644 --- a/src/edits.rs +++ b/src/edits.rs @@ -430,5 +430,19 @@ mod string_pair { assert_eq!(common_suffix_length("ab ", "aab "), 2); assert_eq!(common_suffix_length("aba ", "ba"), 2); } + + #[test] + fn test_common_suffix_length_with_trailing_whitespace_nonascii() { + assert_eq!(common_suffix_length(" ", "á"), 0); + assert_eq!(common_suffix_length("á ", ""), 0); + assert_eq!(common_suffix_length("á", "b "), 0); + assert_eq!(common_suffix_length("á", "á "), 1); + assert_eq!(common_suffix_length("a ", "áb "), 0); + assert_eq!(common_suffix_length("ab", "á "), 0); + assert_eq!(common_suffix_length("áb ", "b "), 1); + assert_eq!(common_suffix_length("áb ", "aáb "), 2); + assert_eq!(common_suffix_length("abá ", "bá"), 2); + assert_eq!(common_suffix_length("áaáabá ", "ááabá "), 4); + } } } -- cgit v1.2.3