-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: panic when comparing ropes with chunks not aligned at char bounds
- Loading branch information
1 parent
594adfa
commit cc516d5
Showing
3 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
_____________ | ||
|
||
______________ㅇ_________ㅇㅇㅇ____ㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇ__________ | ||
________________ | ||
_____________________________________________ | ||
____________________________________________ | ||
_______________ | ||
_____________________________________ | ||
____________________________________________________________________ | ||
______________________ | ||
________________________ | ||
_________________________________________________ | ||
______________________________________________________________ | ||
____________________ | ||
______________________________________________ | ||
_________________ | ||
________________ | ||
|
||
__________________________________________________________ | ||
____________________________________________________ | ||
_______________ | ||
|
||
________________________________________________ | ||
______________________ | ||
________________________ | ||
________________________________________________________________________ | ||
______________________________ | ||
____________________ | ||
__________________________________________ | ||
__________________ | ||
____________________________________________ | ||
________________ | ||
|
||
__________________ | ||
_____________________ | ||
_____________________________________________________ | ||
____________________________________________ | ||
_________________ | ||
___________________________________________ | ||
__________________________________________ | ||
___________________________________________________ | ||
___________________________________________________________________ | ||
_______________________ | ||
_______________ | ||
_____________ | ||
|
||
______________ㅇㅇㅇㅇㅇㅇ____ㅇ_ㅇㅇㅇ____ | ||
______________ㅇㅇㅇㅇ_____________ㅇㅇㅇㅇㅇㅇㅇㅇ____ | ||
____________________________________ | ||
________________________________________________________________________________ | ||
______________________________________ | ||
______________ | ||
|
||
______________ㅇㅇㅇㅇ_______ㅇㅇㅇㅇㅇㅇ_______ㅇㅇ_____________ㅇㅇㅇㅇㅇ____ | ||
________________________________ | ||
__________________________________________________________________ | ||
_________________________ | ||
______________ | ||
|
||
__________________________________________________________________ | ||
_______________________________________________ | ||
|
||
______________________________________ | ||
________________________________________________ | ||
|
||
_______________________________________________ | ||
__________________________________________________________________ | ||
___________ | ||
_________ | ||
_______________________ | ||
________________________________________________ | ||
_______ | ||
______ | ||
|
||
________________________________ | ||
_______________________________________ | ||
______ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
extern crate ropey; | ||
|
||
use ropey::Rope; | ||
|
||
const TEXT1: &str = include_str!("non_ascii.txt"); | ||
|
||
#[test] | ||
#[allow(clippy::cmp_owned)] | ||
#[cfg_attr(miri, ignore)] | ||
fn non_ascii_eq() { | ||
// Build rope from file contents | ||
let rope1 = Rope::from_str(TEXT1); | ||
|
||
let mut rope2 = Rope::from_str(TEXT1); | ||
rope2.remove(1467..1827); | ||
for line1 in rope1.lines() { | ||
for line2 in rope2.lines() { | ||
println!("lines1: {line1} line2: {line2}"); | ||
println!("{}", line1.to_string() == line2); | ||
println!("{}", line1 == line2); | ||
} | ||
} | ||
} | ||
|
||
#[test] | ||
fn non_ascii_ord() { | ||
// Build rope from file contents | ||
let rope1 = Rope::from_str(TEXT1); | ||
|
||
let mut rope2 = Rope::from_str(TEXT1); | ||
rope2.remove(1467..1827); | ||
for line1 in rope1.lines() { | ||
for line2 in rope2.lines() { | ||
println!("lines1: {line1} line2: {line2}"); | ||
println!("{:?}", line2.partial_cmp(&line1)); | ||
} | ||
} | ||
} |