Allow specifying MAX_EXCERPTS via an env variable in random tests
This commit is contained in:
@@ -178,13 +178,18 @@ impl MultiBuffer {
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn build_random(
|
||||
excerpts: usize,
|
||||
mut rng: &mut impl rand::Rng,
|
||||
cx: &mut gpui::MutableAppContext,
|
||||
) -> ModelHandle<Self> {
|
||||
use rand::prelude::*;
|
||||
use std::env;
|
||||
use text::RandomCharIter;
|
||||
|
||||
let max_excerpts = env::var("MAX_EXCERPTS")
|
||||
.map(|i| i.parse().expect("invalid `MAX_EXCERPTS` variable"))
|
||||
.unwrap_or(5);
|
||||
let excerpts = rng.gen_range(1..=max_excerpts);
|
||||
|
||||
cx.add_model(|cx| {
|
||||
let mut multibuffer = MultiBuffer::new(0);
|
||||
let mut buffers = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user