-
Notifications
You must be signed in to change notification settings - Fork 47
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 832e41e
Showing
3 changed files
with
125 additions
and
8 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)); | ||
} | ||
} | ||
} |