Simplify indexing tests

This commit is contained in:
Loïc Lecrenier 2022-08-02 15:13:06 +02:00
parent 21284cf235
commit acff17fb88
6 changed files with 1070 additions and 1726 deletions

View file

@ -179,6 +179,17 @@ macro_rules! documents {
}};
}
#[cfg(test)]
pub fn documents_batch_reader_from_objects(
objects: impl IntoIterator<Item = Object>,
) -> DocumentsBatchReader<std::io::Cursor<Vec<u8>>> {
let mut builder = DocumentsBatchBuilder::new(Vec::new());
for object in objects {
builder.append_json_object(&object).unwrap();
}
DocumentsBatchReader::from_reader(std::io::Cursor::new(builder.into_inner().unwrap())).unwrap()
}
#[cfg(test)]
mod test {
use std::io::Cursor;