Switch to pretty_assertions

This commit is contained in:
Dustin J. Mitchell 2021-10-02 01:01:28 +00:00
parent 267288c9e6
commit a143660124
47 changed files with 130 additions and 17 deletions

View file

@ -146,6 +146,7 @@ impl Replica {
mod tests {
use super::*;
use crate::task::Status;
use pretty_assertions::{assert_eq};
use uuid::Uuid;
#[test]

View file

@ -159,6 +159,7 @@ impl Server for LocalServer {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
use tempfile::TempDir;
#[test]

View file

@ -78,6 +78,7 @@ impl AsRef<[u8]> for HistoryCiphertext {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
#[test]
fn round_trip() {

View file

@ -166,6 +166,7 @@ impl Storage for InMemoryStorage {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
// (note: this module is heavily used in tests so most of its functionality is well-tested
// elsewhere and not tested here)

View file

@ -128,6 +128,7 @@ mod test {
use crate::storage::InMemoryStorage;
use crate::taskdb::TaskDb;
use chrono::{Duration, Utc};
use pretty_assertions::{assert_eq};
use proptest::prelude::*;
// note that `tests/operation_transform_invariant.rs` tests the transform function quite

View file

@ -113,9 +113,11 @@ impl<'t> Txn<'t> {
fn get_next_working_set_number(&self) -> anyhow::Result<usize> {
let t = self.get_txn()?;
let next_id: Option<usize> = t
.query_row("SELECT COALESCE(MAX(id), 0) + 1 FROM working_set", [], |r| {
r.get(0)
})
.query_row(
"SELECT COALESCE(MAX(id), 0) + 1 FROM working_set",
[],
|r| r.get(0),
)
.optional()
.context("Getting highest working set ID")?;
@ -290,7 +292,10 @@ impl<'t> StorageTxn for Txn<'t> {
let rows: Vec<Result<(usize, Uuid), _>> = rows.collect();
let mut res = Vec::with_capacity(rows.len());
for _ in 0..self.get_next_working_set_number().context("Getting working set number")? {
for _ in 0..self
.get_next_working_set_number()
.context("Getting working set number")?
{
res.push(None);
}
for r in rows {
@ -351,6 +356,7 @@ impl<'t> StorageTxn for Txn<'t> {
mod test {
use super::*;
use crate::storage::taskmap_with;
use pretty_assertions::{assert_eq};
use tempfile::TempDir;
#[test]

View file

@ -35,6 +35,7 @@ impl Priority {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
#[test]
fn test_priority() {

View file

@ -41,6 +41,7 @@ impl Status {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
#[test]
fn test_status() {

View file

@ -138,6 +138,7 @@ pub(super) enum SyntheticTag {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
use rstest::rstest;
use std::convert::TryInto;

View file

@ -300,6 +300,7 @@ impl<'r> std::ops::Deref for TaskMut<'r> {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
fn with_mut_task<F: FnOnce(TaskMut)>(f: F) {
let mut replica = Replica::new_inmemory();

View file

@ -359,6 +359,7 @@ mod tests {
use crate::server::test::TestServer;
use crate::storage::InMemoryStorage;
use chrono::Utc;
use pretty_assertions::{assert_eq};
use proptest::prelude::*;
use std::collections::HashMap;
use uuid::Uuid;

View file

@ -41,6 +41,7 @@ impl AsRef<[u8]> for Key {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
#[test]
fn test_from_bytes() {

View file

@ -69,6 +69,7 @@ impl WorkingSet {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::{assert_eq};
fn make() -> (Uuid, Uuid, WorkingSet) {
let uuid1 = Uuid::new_v4();