Merge pull request #292 from taskchampion/issue291

Switch to pretty_assertions
This commit is contained in:
Dustin J. Mitchell 2021-10-02 10:54:25 -04:00 committed by GitHub
commit d01386f3ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 97 additions and 1 deletions

52
Cargo.lock generated
View file

@ -313,6 +313,15 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi 0.3.9",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.41" version = "1.0.41"
@ -629,7 +638,7 @@ version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [ dependencies = [
"ansi_term", "ansi_term 0.11.0",
"atty", "atty",
"bitflags", "bitflags",
"strsim", "strsim",
@ -748,6 +757,16 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ctor"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
dependencies = [
"quote",
"syn",
]
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.14" version = "0.99.14"
@ -772,6 +791,12 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "diff"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499"
[[package]] [[package]]
name = "difference" name = "difference"
version = "2.0.0" version = "2.0.0"
@ -1935,6 +1960,15 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "output_vt100"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9"
dependencies = [
"winapi 0.3.9",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.1" version = "0.11.1"
@ -2152,6 +2186,18 @@ dependencies = [
"treeline", "treeline",
] ]
[[package]]
name = "pretty_assertions"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0cfe1b2403f172ba0f234e500906ee0a3e493fb81092dac23ebefe129301cc"
dependencies = [
"ansi_term 0.12.1",
"ctor",
"diff",
"output_vt100",
]
[[package]] [[package]]
name = "prettytable-rs" name = "prettytable-rs"
version = "0.8.0" version = "0.8.0"
@ -2427,6 +2473,7 @@ dependencies = [
"actix-rt", "actix-rt",
"actix-web", "actix-web",
"anyhow", "anyhow",
"pretty_assertions",
"taskchampion", "taskchampion",
"taskchampion-sync-server", "taskchampion-sync-server",
"tempfile", "tempfile",
@ -2916,6 +2963,7 @@ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
"log", "log",
"pretty_assertions",
"proptest", "proptest",
"rstest", "rstest",
"rusqlite", "rusqlite",
@ -2948,6 +2996,7 @@ dependencies = [
"mdbook", "mdbook",
"nom 6.1.2", "nom 6.1.2",
"predicates", "predicates",
"pretty_assertions",
"prettytable-rs", "prettytable-rs",
"rstest", "rstest",
"serde_json", "serde_json",
@ -2971,6 +3020,7 @@ dependencies = [
"env_logger 0.8.4", "env_logger 0.8.4",
"futures", "futures",
"log", "log",
"pretty_assertions",
"rusqlite", "rusqlite",
"serde", "serde",
"serde_json", "serde_json",

View file

@ -43,6 +43,7 @@ assert_cmd = "^1.0.3"
predicates = "^1.0.7" predicates = "^1.0.7"
tempfile = "3" tempfile = "3"
rstest = "0.10" rstest = "0.10"
pretty_assertions = "1"
[features] [features]
usage-docs = [ "mdbook", "serde_json" ] usage-docs = [ "mdbook", "serde_json" ]

View file

@ -43,6 +43,7 @@ where
mod test { mod test {
use super::super::*; use super::super::*;
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_arg_matching() { fn test_arg_matching() {

View file

@ -51,6 +51,7 @@ pub(crate) fn wait_colon(input: &str) -> IResult<&str, Option<DateTime<Utc>>> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_colon_prefix() { fn test_colon_prefix() {

View file

@ -75,6 +75,7 @@ pub(crate) fn id_list(input: &str) -> IResult<&str, Vec<TaskId>> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_id_list_single() { fn test_id_list_single() {

View file

@ -20,6 +20,7 @@ pub(crate) fn literal(literal: &'static str) -> impl Fn(&str) -> IResult<&str, &
mod test { mod test {
use super::super::*; use super::super::*;
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_arg_matching() { fn test_arg_matching() {

View file

@ -15,6 +15,7 @@ pub(crate) fn minus_tag(input: &str) -> IResult<&str, Tag> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_plus_tag() { fn test_plus_tag() {

View file

@ -239,6 +239,7 @@ pub(crate) fn timestamp<Tz: TimeZone + Copy>(
mod test { mod test {
use super::*; use super::*;
use crate::argparse::NOW; use crate::argparse::NOW;
use pretty_assertions::assert_eq;
use rstest::rstest; use rstest::rstest;
const M: i64 = 60; const M: i64 = 60;

View file

@ -58,6 +58,7 @@ impl Command {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
// NOTE: most testing of specific subcommands is handled in `subcommand.rs`. // NOTE: most testing of specific subcommands is handled in `subcommand.rs`.

View file

@ -201,6 +201,7 @@ impl Filter {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_empty_parse0() { fn test_empty_parse0() {

View file

@ -165,6 +165,7 @@ impl Modification {
mod test { mod test {
use super::*; use super::*;
use crate::argparse::NOW; use crate::argparse::NOW;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_empty() { fn test_empty() {

View file

@ -411,6 +411,7 @@ impl Sync {
mod test { mod test {
use super::*; use super::*;
use crate::argparse::Condition; use crate::argparse::Condition;
use pretty_assertions::assert_eq;
const EMPTY: Vec<&str> = vec![]; const EMPTY: Vec<&str> = vec![];

View file

@ -39,6 +39,7 @@ impl From<std::io::Error> for Error {
mod test { mod test {
use super::*; use super::*;
use anyhow::anyhow; use anyhow::anyhow;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_exit_status() { fn test_exit_status() {

View file

@ -20,6 +20,7 @@ pub(crate) fn execute<W: WriteColor>(
mod test { mod test {
use super::*; use super::*;
use crate::invocation::test::*; use crate::invocation::test::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_add() { fn test_add() {

View file

@ -34,6 +34,7 @@ pub(crate) fn execute<W: WriteColor>(
mod test { mod test {
use super::*; use super::*;
use crate::invocation::test::*; use crate::invocation::test::*;
use pretty_assertions::assert_eq;
use std::fs; use std::fs;
use tempfile::TempDir; use tempfile::TempDir;

View file

@ -12,6 +12,7 @@ pub(crate) fn execute<W: WriteColor>(w: &mut W, replica: &mut Replica) -> Result
mod test { mod test {
use super::*; use super::*;
use crate::invocation::test::*; use crate::invocation::test::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_gc() { fn test_gc() {

View file

@ -50,6 +50,7 @@ pub(crate) fn execute<W: WriteColor>(
mod test { mod test {
use super::*; use super::*;
use crate::invocation::test::*; use crate::invocation::test::*;
use taskchampion::Status; use taskchampion::Status;
#[test] #[test]

View file

@ -71,6 +71,7 @@ mod test {
use crate::argparse::DescriptionMod; use crate::argparse::DescriptionMod;
use crate::invocation::test::test_replica; use crate::invocation::test::test_replica;
use crate::invocation::test::*; use crate::invocation::test::*;
use pretty_assertions::assert_eq;
use taskchampion::Status; use taskchampion::Status;
#[test] #[test]

View file

@ -19,6 +19,7 @@ mod test {
use super::*; use super::*;
use crate::argparse::Filter; use crate::argparse::Filter;
use crate::invocation::test::*; use crate::invocation::test::*;
use taskchampion::Status; use taskchampion::Status;
#[test] #[test]

View file

@ -15,6 +15,7 @@ pub(crate) fn execute<W: WriteColor>(
mod test { mod test {
use super::*; use super::*;
use crate::invocation::test::*; use crate::invocation::test::*;
use pretty_assertions::assert_eq;
use tempfile::TempDir; use tempfile::TempDir;
#[test] #[test]

View file

@ -172,6 +172,7 @@ pub(super) fn filtered_tasks(
mod test { mod test {
use super::*; use super::*;
use crate::invocation::test::*; use crate::invocation::test::*;
use pretty_assertions::assert_eq;
use taskchampion::Status; use taskchampion::Status;
#[test] #[test]

View file

@ -133,6 +133,7 @@ mod test {
use crate::invocation::test::*; use crate::invocation::test::*;
use crate::settings::Sort; use crate::settings::Sort;
use chrono::prelude::*; use chrono::prelude::*;
use pretty_assertions::assert_eq;
use std::convert::TryInto; use std::convert::TryInto;
use taskchampion::{Status, Uuid}; use taskchampion::{Status, Uuid};

View file

@ -259,6 +259,7 @@ pub(crate) fn get_usage(u: &mut Usage) {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
use taskchampion::Status; use taskchampion::Status;
use toml::toml; use toml::toml;

View file

@ -325,6 +325,7 @@ impl Default for Settings {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
use tempfile::TempDir; use tempfile::TempDir;
use toml::toml; use toml::toml;

View file

@ -17,6 +17,7 @@ pub(super) fn table_with_keys<'a>(cfg: &'a toml::Value, keys: &[&str]) -> Result
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
use toml::toml; use toml::toml;
#[test] #[test]

View file

@ -16,3 +16,4 @@ anyhow = "1.0"
actix-web = "^3.3.2" actix-web = "^3.3.2"
actix-rt = "^1.1.1" actix-rt = "^1.1.1"
tempfile = "3" tempfile = "3"
pretty_assertions = "1"

View file

@ -1,4 +1,5 @@
use actix_web::{App, HttpServer}; use actix_web::{App, HttpServer};
use pretty_assertions::assert_eq;
use taskchampion::{Replica, ServerConfig, Status, StorageConfig, Uuid}; use taskchampion::{Replica, ServerConfig, Status, StorageConfig, Uuid};
use taskchampion_sync_server::{storage::InMemoryStorage, Server}; use taskchampion_sync_server::{storage::InMemoryStorage, Server};

View file

@ -23,3 +23,4 @@ rusqlite = { version = "0.25", features = ["bundled"] }
[dev-dependencies] [dev-dependencies]
actix-rt = "^1.1.1" actix-rt = "^1.1.1"
tempfile = "3" tempfile = "3"
pretty_assertions = "1"

View file

@ -80,6 +80,7 @@ mod test {
use crate::storage::{InMemoryStorage, Storage}; use crate::storage::{InMemoryStorage, Storage};
use crate::Server; use crate::Server;
use actix_web::{http::StatusCode, test, App}; use actix_web::{http::StatusCode, test, App};
use pretty_assertions::assert_eq;
use uuid::Uuid; use uuid::Uuid;
#[actix_rt::test] #[actix_rt::test]

View file

@ -47,6 +47,7 @@ mod test {
use crate::storage::{InMemoryStorage, Storage}; use crate::storage::{InMemoryStorage, Storage};
use crate::Server; use crate::Server;
use actix_web::{http::StatusCode, test, App}; use actix_web::{http::StatusCode, test, App};
use pretty_assertions::assert_eq;
use uuid::Uuid; use uuid::Uuid;
#[actix_rt::test] #[actix_rt::test]

View file

@ -65,6 +65,7 @@ async fn main() -> anyhow::Result<()> {
mod test { mod test {
use super::*; use super::*;
use actix_web::{test, App}; use actix_web::{test, App};
use pretty_assertions::assert_eq;
use taskchampion_sync_server::storage::InMemoryStorage; use taskchampion_sync_server::storage::InMemoryStorage;
#[actix_rt::test] #[actix_rt::test]

View file

@ -81,6 +81,7 @@ pub(crate) fn add_version<'a>(
mod test { mod test {
use super::*; use super::*;
use crate::storage::{InMemoryStorage, Storage}; use crate::storage::{InMemoryStorage, Storage};
use pretty_assertions::assert_eq;
#[test] #[test]
fn gcv_not_found() -> anyhow::Result<()> { fn gcv_not_found() -> anyhow::Result<()> {

View file

@ -203,6 +203,7 @@ impl StorageTxn for Txn {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
use tempfile::TempDir; use tempfile::TempDir;
#[test] #[test]

View file

@ -28,3 +28,4 @@ strum_macros = "0.21"
proptest = "^1.0.0" proptest = "^1.0.0"
tempfile = "3" tempfile = "3"
rstest = "0.10" rstest = "0.10"
pretty_assertions = "1"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -356,6 +356,7 @@ impl<'t> StorageTxn for Txn<'t> {
mod test { mod test {
use super::*; use super::*;
use crate::storage::taskmap_with; use crate::storage::taskmap_with;
use pretty_assertions::assert_eq;
use tempfile::TempDir; use tempfile::TempDir;
#[test] #[test]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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