mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Drop proptest tests
It takes waaay to long to compile. We should add quickcheck tests when we touch the relevant code next time.
This commit is contained in:
parent
b4c30fb896
commit
57140f1730
9 changed files with 18 additions and 390 deletions
|
@ -297,45 +297,3 @@ impl RunningLineCol {
|
|||
self.col_adjust += range.len() - TextUnit::from(1);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use proptest::{prelude::*, proptest};
|
||||
use ra_text_edit::test_utils::{arb_offset, arb_text_with_edit};
|
||||
use ra_text_edit::TextEdit;
|
||||
|
||||
use crate::line_index;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ArbTextWithEditAndOffset {
|
||||
text: String,
|
||||
edit: TextEdit,
|
||||
edited_text: String,
|
||||
offset: TextUnit,
|
||||
}
|
||||
|
||||
fn arb_text_with_edit_and_offset() -> BoxedStrategy<ArbTextWithEditAndOffset> {
|
||||
arb_text_with_edit()
|
||||
.prop_flat_map(|x| {
|
||||
let edited_text = x.edit.apply(&x.text);
|
||||
let arb_offset = arb_offset(&edited_text);
|
||||
(Just(x), Just(edited_text), arb_offset).prop_map(|(x, edited_text, offset)| {
|
||||
ArbTextWithEditAndOffset { text: x.text, edit: x.edit, edited_text, offset }
|
||||
})
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
|
||||
proptest! {
|
||||
#[test]
|
||||
fn test_translate_offset_with_edit(x in arb_text_with_edit_and_offset()) {
|
||||
let expected = line_index::to_line_col(&x.edited_text, x.offset);
|
||||
let line_index = LineIndex::new(&x.text);
|
||||
let actual = translate_offset_with_edit(&line_index, x.offset, &x.edit);
|
||||
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue