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:
Aleksey Kladov 2020-02-17 16:57:06 +01:00
parent b4c30fb896
commit 57140f1730
9 changed files with 18 additions and 390 deletions

View file

@ -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);
}
}
}