Create MultiBuffers with more than one fragment in more randomized tests

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-12-15 18:38:37 +01:00
parent 1bdaeda43e
commit 80abd84050
2 changed files with 17 additions and 9 deletions

View file

@ -505,9 +505,13 @@ mod tests {
log::info!("wrap width: {:?}", wrap_width);
let buffer = cx.update(|cx| {
let len = rng.gen_range(0..10);
let text = RandomCharIter::new(&mut rng).take(len).collect::<String>();
MultiBuffer::build_simple(&text, cx)
if rng.gen() {
let len = rng.gen_range(0..10);
let text = RandomCharIter::new(&mut rng).take(len).collect::<String>();
MultiBuffer::build_simple(&text, cx)
} else {
MultiBuffer::build_random(rng.gen_range(1..=5), &mut rng, cx)
}
});
let map = cx.add_model(|cx| {