Refactor filtering to start with a universe
This commit is contained in:
@@ -20,7 +20,7 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
|
||||
#[test]
|
||||
fn test_add() {
|
||||
|
||||
@@ -11,7 +11,7 @@ pub(crate) fn execute<W: WriteColor>(w: &mut W, replica: &mut Replica) -> Fallib
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
|
||||
#[test]
|
||||
fn test_gc() {
|
||||
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
|
||||
#[test]
|
||||
fn test_summary() {
|
||||
|
||||
@@ -45,7 +45,7 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -34,7 +34,7 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::argparse::Filter;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -8,6 +8,3 @@ pub(crate) mod list;
|
||||
pub(crate) mod modify;
|
||||
pub(crate) mod sync;
|
||||
pub(crate) mod version;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
@@ -23,8 +23,8 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::argparse::DescriptionMod;
|
||||
use crate::invocation::cmd::test::test_replica;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::test_replica;
|
||||
use crate::invocation::test::*;
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
use tempdir::TempDir;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
use std::io;
|
||||
use taskchampion::{server, taskstorage, Replica, ServerConfig};
|
||||
use tempdir::TempDir;
|
||||
|
||||
pub(super) fn test_replica() -> Replica {
|
||||
let storage = taskstorage::InMemoryStorage::new();
|
||||
Replica::new(Box::new(storage))
|
||||
}
|
||||
|
||||
pub(super) fn test_server(dir: &TempDir) -> Box<dyn server::Server> {
|
||||
server::from_config(ServerConfig::Local {
|
||||
server_dir: dir.path().to_path_buf(),
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub(super) struct TestWriter {
|
||||
data: Vec<u8>,
|
||||
}
|
||||
|
||||
impl TestWriter {
|
||||
pub(super) fn into_string(self) -> String {
|
||||
String::from_utf8(self.data).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl io::Write for TestWriter {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
self.data.write(buf)
|
||||
}
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
self.data.flush()
|
||||
}
|
||||
}
|
||||
|
||||
impl termcolor::WriteColor for TestWriter {
|
||||
fn supports_color(&self) -> bool {
|
||||
false
|
||||
}
|
||||
fn set_color(&mut self, _spec: &termcolor::ColorSpec) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn reset(&mut self) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn test_writer() -> TestWriter {
|
||||
TestWriter { data: vec![] }
|
||||
}
|
||||
@@ -12,7 +12,7 @@ pub(crate) fn execute<W: WriteColor>(w: &mut W) -> Fallible<()> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::*;
|
||||
use crate::invocation::test::*;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
|
||||
Reference in New Issue
Block a user