mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Switch to pretty_assertions
This commit is contained in:
parent
267288c9e6
commit
a143660124
47 changed files with 130 additions and 17 deletions
52
Cargo.lock
generated
52
Cargo.lock
generated
|
@ -313,6 +313,15 @@ dependencies = [
|
|||
"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]]
|
||||
name = "anyhow"
|
||||
version = "1.0.41"
|
||||
|
@ -629,7 +638,7 @@ version = "2.33.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"ansi_term 0.11.0",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"strsim",
|
||||
|
@ -748,6 +757,16 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.14"
|
||||
|
@ -772,6 +791,12 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "diff"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499"
|
||||
|
||||
[[package]]
|
||||
name = "difference"
|
||||
version = "2.0.0"
|
||||
|
@ -1935,6 +1960,15 @@ dependencies = [
|
|||
"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]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.1"
|
||||
|
@ -2152,6 +2186,18 @@ dependencies = [
|
|||
"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]]
|
||||
name = "prettytable-rs"
|
||||
version = "0.8.0"
|
||||
|
@ -2427,6 +2473,7 @@ dependencies = [
|
|||
"actix-rt",
|
||||
"actix-web",
|
||||
"anyhow",
|
||||
"pretty_assertions",
|
||||
"taskchampion",
|
||||
"taskchampion-sync-server",
|
||||
"tempfile",
|
||||
|
@ -2916,6 +2963,7 @@ dependencies = [
|
|||
"anyhow",
|
||||
"chrono",
|
||||
"log",
|
||||
"pretty_assertions",
|
||||
"proptest",
|
||||
"rstest",
|
||||
"rusqlite",
|
||||
|
@ -2948,6 +2996,7 @@ dependencies = [
|
|||
"mdbook",
|
||||
"nom 6.1.2",
|
||||
"predicates",
|
||||
"pretty_assertions",
|
||||
"prettytable-rs",
|
||||
"rstest",
|
||||
"serde_json",
|
||||
|
@ -2971,6 +3020,7 @@ dependencies = [
|
|||
"env_logger 0.8.4",
|
||||
"futures",
|
||||
"log",
|
||||
"pretty_assertions",
|
||||
"rusqlite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -43,6 +43,7 @@ assert_cmd = "^1.0.3"
|
|||
predicates = "^1.0.7"
|
||||
tempfile = "3"
|
||||
rstest = "0.10"
|
||||
pretty_assertions = "1"
|
||||
|
||||
[features]
|
||||
usage-docs = [ "mdbook", "serde_json" ]
|
||||
|
|
|
@ -43,6 +43,7 @@ where
|
|||
mod test {
|
||||
use super::super::*;
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_arg_matching() {
|
||||
|
|
|
@ -51,6 +51,7 @@ pub(crate) fn wait_colon(input: &str) -> IResult<&str, Option<DateTime<Utc>>> {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_colon_prefix() {
|
||||
|
|
|
@ -75,6 +75,7 @@ pub(crate) fn id_list(input: &str) -> IResult<&str, Vec<TaskId>> {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_id_list_single() {
|
||||
|
|
|
@ -20,6 +20,7 @@ pub(crate) fn literal(literal: &'static str) -> impl Fn(&str) -> IResult<&str, &
|
|||
mod test {
|
||||
use super::super::*;
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_arg_matching() {
|
||||
|
|
|
@ -15,6 +15,7 @@ pub(crate) fn minus_tag(input: &str) -> IResult<&str, Tag> {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_plus_tag() {
|
||||
|
|
|
@ -162,10 +162,22 @@ fn named_date<Tz: TimeZone>(
|
|||
// TODO: lots more!
|
||||
"eod" => Ok((remaining, local_today + Duration::days(1))),
|
||||
"sod" => Ok((remaining, local_today)),
|
||||
"eow" => Ok((remaining,local_today + Duration::days((6-day_index).into()))),
|
||||
"eoww" => Ok((remaining,local_today + Duration::days((5-day_index).into()))),
|
||||
"sow" => Ok((remaining,local_today + Duration::days((6-day_index).into()))),
|
||||
"soww" => Ok((remaining,local_today + Duration::days((7-day_index).into()))),
|
||||
"eow" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((6 - day_index).into()),
|
||||
)),
|
||||
"eoww" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((5 - day_index).into()),
|
||||
)),
|
||||
"sow" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((6 - day_index).into()),
|
||||
)),
|
||||
"soww" => Ok((
|
||||
remaining,
|
||||
local_today + Duration::days((7 - day_index).into()),
|
||||
)),
|
||||
_ => Err(Err::Error(Error::new(input, ErrorKind::Tag))),
|
||||
}
|
||||
.map(|(rem, dt)| (rem, dt.and_hms(0, 0, 0).with_timezone(&Utc)))
|
||||
|
@ -227,6 +239,7 @@ pub(crate) fn timestamp<Tz: TimeZone + Copy>(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::argparse::NOW;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
const M: i64 = 60;
|
||||
|
|
|
@ -58,6 +58,7 @@ impl Command {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
// NOTE: most testing of specific subcommands is handled in `subcommand.rs`.
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ impl Filter {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_empty_parse0() {
|
||||
|
|
|
@ -165,6 +165,7 @@ impl Modification {
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::argparse::NOW;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_empty() {
|
||||
|
|
|
@ -411,6 +411,7 @@ impl Sync {
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::argparse::Condition;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
const EMPTY: Vec<&str> = vec![];
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ impl From<std::io::Error> for Error {
|
|||
mod test {
|
||||
use super::*;
|
||||
use anyhow::anyhow;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_exit_status() {
|
||||
|
|
|
@ -20,6 +20,7 @@ pub(crate) fn execute<W: WriteColor>(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::test::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_add() {
|
||||
|
|
|
@ -34,6 +34,7 @@ pub(crate) fn execute<W: WriteColor>(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::test::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::fs;
|
||||
use tempfile::TempDir;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ pub(crate) fn execute<W: WriteColor>(w: &mut W, replica: &mut Replica) -> Result
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::test::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn test_gc() {
|
||||
|
|
|
@ -50,6 +50,7 @@ pub(crate) fn execute<W: WriteColor>(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::test::*;
|
||||
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -71,6 +71,7 @@ mod test {
|
|||
use crate::argparse::DescriptionMod;
|
||||
use crate::invocation::test::test_replica;
|
||||
use crate::invocation::test::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -19,6 +19,7 @@ mod test {
|
|||
use super::*;
|
||||
use crate::argparse::Filter;
|
||||
use crate::invocation::test::*;
|
||||
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -15,6 +15,7 @@ pub(crate) fn execute<W: WriteColor>(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::test::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -172,6 +172,7 @@ pub(super) fn filtered_tasks(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::test::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -133,6 +133,7 @@ mod test {
|
|||
use crate::invocation::test::*;
|
||||
use crate::settings::Sort;
|
||||
use chrono::prelude::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::convert::TryInto;
|
||||
use taskchampion::{Status, Uuid};
|
||||
|
||||
|
|
|
@ -259,6 +259,7 @@ pub(crate) fn get_usage(u: &mut Usage) {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use taskchampion::Status;
|
||||
use toml::toml;
|
||||
|
||||
|
|
|
@ -325,6 +325,7 @@ impl Default for Settings {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
use toml::toml;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ pub(super) fn table_with_keys<'a>(cfg: &'a toml::Value, keys: &[&str]) -> Result
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use toml::toml;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -16,3 +16,4 @@ anyhow = "1.0"
|
|||
actix-web = "^3.3.2"
|
||||
actix-rt = "^1.1.1"
|
||||
tempfile = "3"
|
||||
pretty_assertions = "1"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use actix_web::{App, HttpServer};
|
||||
use pretty_assertions::assert_eq;
|
||||
use taskchampion::{Replica, ServerConfig, Status, StorageConfig, Uuid};
|
||||
use taskchampion_sync_server::{storage::InMemoryStorage, Server};
|
||||
|
||||
|
|
|
@ -23,3 +23,4 @@ rusqlite = { version = "0.25", features = ["bundled"] }
|
|||
[dev-dependencies]
|
||||
actix-rt = "^1.1.1"
|
||||
tempfile = "3"
|
||||
pretty_assertions = "1"
|
||||
|
|
|
@ -80,6 +80,7 @@ mod test {
|
|||
use crate::storage::{InMemoryStorage, Storage};
|
||||
use crate::Server;
|
||||
use actix_web::{http::StatusCode, test, App};
|
||||
use pretty_assertions::{assert_eq};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[actix_rt::test]
|
||||
|
|
|
@ -47,6 +47,7 @@ mod test {
|
|||
use crate::storage::{InMemoryStorage, Storage};
|
||||
use crate::Server;
|
||||
use actix_web::{http::StatusCode, test, App};
|
||||
use pretty_assertions::{assert_eq};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[actix_rt::test]
|
||||
|
|
|
@ -65,6 +65,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
mod test {
|
||||
use super::*;
|
||||
use actix_web::{test, App};
|
||||
use pretty_assertions::{assert_eq};
|
||||
use taskchampion_sync_server::storage::InMemoryStorage;
|
||||
|
||||
#[actix_rt::test]
|
||||
|
|
|
@ -81,6 +81,7 @@ pub(crate) fn add_version<'a>(
|
|||
mod test {
|
||||
use super::*;
|
||||
use crate::storage::{InMemoryStorage, Storage};
|
||||
use pretty_assertions::{assert_eq};
|
||||
|
||||
#[test]
|
||||
fn gcv_not_found() -> anyhow::Result<()> {
|
||||
|
|
|
@ -203,6 +203,7 @@ impl StorageTxn for Txn {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq};
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -28,3 +28,4 @@ strum_macros = "0.21"
|
|||
proptest = "^1.0.0"
|
||||
tempfile = "3"
|
||||
rstest = "0.10"
|
||||
pretty_assertions = "1"
|
||||
|
|
|
@ -146,6 +146,7 @@ impl Replica {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::task::Status;
|
||||
use pretty_assertions::{assert_eq};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -159,6 +159,7 @@ impl Server for LocalServer {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq};
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -78,6 +78,7 @@ impl AsRef<[u8]> for HistoryCiphertext {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq};
|
||||
|
||||
#[test]
|
||||
fn round_trip() {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -35,6 +35,7 @@ impl Priority {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq};
|
||||
|
||||
#[test]
|
||||
fn test_priority() {
|
||||
|
|
|
@ -41,6 +41,7 @@ impl Status {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use pretty_assertions::{assert_eq};
|
||||
|
||||
#[test]
|
||||
fn test_status() {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue