summaryrefslogtreecommitdiffstats
path: root/src/edits.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2019-07-19 11:40:15 -0400
committerDan Davison <dandavison7@gmail.com>2019-07-20 18:09:35 -0400
commit94848668f06c9e2c9802e87e2d9bd472914ade98 (patch)
tree508fccbe79dc325da7aaecbe229b29ffbdf60382 /src/edits.rs
parentdc0318f2947536e33eb1a77a9cc8a612fd39d1cd (diff)
Add more non-ascii tests
Diffstat (limited to 'src/edits.rs')
-rw-r--r--src/edits.rs14
1 files changed, 14 insertions, 0 deletions
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);
+ }
}
}