mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
31 lines
839 B
Rust
31 lines
839 B
Rust
use taskchampion::{server::Server, Replica};
|
|
use termcolor::WriteColor;
|
|
|
|
pub(crate) fn execute<W: WriteColor>(
|
|
w: &mut W,
|
|
replica: &mut Replica,
|
|
server: &mut Box<dyn Server>,
|
|
) -> Result<(), crate::Error> {
|
|
replica.sync(server)?;
|
|
writeln!(w, "sync complete.")?;
|
|
Ok(())
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod test {
|
|
use super::*;
|
|
use crate::invocation::test::*;
|
|
use tempfile::TempDir;
|
|
|
|
#[test]
|
|
fn test_add() {
|
|
let mut w = test_writer();
|
|
let mut replica = test_replica();
|
|
let server_dir = TempDir::new().unwrap();
|
|
let mut server = test_server(&server_dir);
|
|
|
|
// Note that the details of the actual sync are tested thoroughly in the taskchampion crate
|
|
execute(&mut w, &mut replica, &mut server).unwrap();
|
|
assert_eq!(&w.into_string(), "sync complete.\n")
|
|
}
|
|
}
|