diff options
author | Dan Davison <dandavison7@gmail.com> | 2019-07-19 10:20:34 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2019-07-20 18:09:35 -0400 |
commit | 1374863f71d00371c45fa6a3cef39fbbbeab7fcf (patch) | |
tree | 72013863c9b48d1baa3430fc55e478bbbd5dc54b /src/edits.rs | |
parent | 6563c30a5721197af17ebd2a75fcc2b50f42b9b2 (diff) |
Failing test: edit inference: non-ascii
This panics with a byte index not at a char boundary.
Diffstat (limited to 'src/edits.rs')
-rw-r--r-- | src/edits.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/edits.rs b/src/edits.rs index b183a6e1..8ad52797 100644 --- a/src/edits.rs +++ b/src/edits.rs @@ -158,6 +158,35 @@ mod tests { } #[test] + fn test_get_diff_style_sections_1_nonascii() { + let actual_edits = get_diff_style_sections( + &vec!["áaa\n".to_string()], + &vec!["ááb\n".to_string()], + MINUS, + MINUS_EMPH, + PLUS, + PLUS_EMPH, + 1.0, + ); + let expected_edits = ( + vec![as_strings(vec![ + (MINUS, "á"), + (MINUS_EMPH, "aa"), + (MINUS, "\n"), + ])], + vec![as_strings(vec![ + (PLUS, "á"), + (PLUS_EMPH, "áb"), + (PLUS, "\n"), + ])], + ); + + assert_consistent(&expected_edits); + assert_consistent(&actual_edits); + assert_eq!(actual_edits, expected_edits); + } + + #[test] fn test_get_diff_style_sections_2() { let actual_edits = get_diff_style_sections( &vec!["d.iteritems()\n".to_string()], |