Add tests that randomly edit files with disjoint included ranges
This commit is contained in:
parent
efd22e452b
commit
8e3dc7cd7a
5 changed files with 176 additions and 42 deletions
|
|
@ -4,7 +4,7 @@ use rand::{
|
|||
};
|
||||
|
||||
const OPERATORS: &[char] = &[
|
||||
'+', '-', '<', '>', '(', ')', '*', '/', '&', '|', '!', ',', '.',
|
||||
'+', '-', '<', '>', '(', ')', '*', '/', '&', '|', '!', ',', '.', '%',
|
||||
];
|
||||
|
||||
pub struct Rand(StdRng);
|
||||
|
|
|
|||
|
|
@ -44,20 +44,10 @@ impl ScopeSequence {
|
|||
text: &Vec<u8>,
|
||||
known_changed_ranges: &Vec<Range>,
|
||||
) -> Result<(), String> {
|
||||
if self.0.len() != text.len() {
|
||||
panic!(
|
||||
"Inconsistent scope sequence: {:?}",
|
||||
self.0
|
||||
.iter()
|
||||
.zip(text.iter().map(|c| *c as char))
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
}
|
||||
|
||||
assert_eq!(self.0.len(), other.0.len());
|
||||
let mut position = Point { row: 0, column: 0 };
|
||||
for (i, stack) in self.0.iter().enumerate() {
|
||||
let other_stack = &other.0[i];
|
||||
for i in 0..(self.0.len().max(other.0.len())) {
|
||||
let stack = &self.0.get(i);
|
||||
let other_stack = &other.0.get(i);
|
||||
if *stack != *other_stack && ![b'\r', b'\n'].contains(&text[i]) {
|
||||
let containing_range = known_changed_ranges
|
||||
.iter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue