diff --git a/Cargo.lock b/Cargo.lock index 91ff146..0b87be1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,6 +40,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + [[package]] name = "autocfg" version = "1.0.1" @@ -254,6 +263,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "ctor" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "dbus" version = "0.2.3" @@ -280,6 +299,12 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "diff" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" + [[package]] name = "digest" version = "0.9.0" @@ -762,6 +787,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "output_vt100" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" +dependencies = [ + "winapi", +] + [[package]] name = "parking_lot" version = "0.10.2" @@ -835,6 +869,18 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +[[package]] +name = "pretty_assertions" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cab0e7c02cf376875e9335e0ba1da535775beb5450d21e1dffca068818ed98b" +dependencies = [ + "ansi_term", + "ctor", + "diff", + "output_vt100", +] + [[package]] name = "proc-macro2" version = "1.0.26" @@ -1260,6 +1306,7 @@ dependencies = [ "lazy_static", "magic-crypt", "path-slash", + "pretty_assertions", "rand 0.8.3", "regex", "rpassword", diff --git a/Cargo.toml b/Cargo.toml index 00aeb58..f096d4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,9 @@ tuirealm = { version = "0.2.2", features = [ "with-components" ] } whoami = "1.1.1" wildmatch = "2.0.0" +[dev-dependencies] +pretty_assertions = "0.7.2" + [dependencies.ftp4] features = ["secure"] version = "^4.0.2" diff --git a/src/bookmarks/mod.rs b/src/bookmarks/mod.rs index 77c0c78..58a29cf 100644 --- a/src/bookmarks/mod.rs +++ b/src/bookmarks/mod.rs @@ -119,6 +119,7 @@ impl std::fmt::Display for SerializerError { mod tests { use super::*; + use pretty_assertions::assert_eq; #[test] fn test_bookmarks_bookmark_new() { diff --git a/src/bookmarks/serializer.rs b/src/bookmarks/serializer.rs index bfa4e8d..6a5b0be 100644 --- a/src/bookmarks/serializer.rs +++ b/src/bookmarks/serializer.rs @@ -91,6 +91,7 @@ mod tests { use super::super::Bookmark; use super::*; + use pretty_assertions::assert_eq; use std::collections::HashMap; use std::io::{Seek, SeekFrom}; diff --git a/src/config/mod.rs b/src/config/mod.rs index a611af6..4153bc2 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -163,6 +163,7 @@ impl std::fmt::Display for SerializerError { mod tests { use super::*; + use pretty_assertions::assert_eq; use std::env; #[test] diff --git a/src/config/serializer.rs b/src/config/serializer.rs index a95d0cf..dd5670d 100644 --- a/src/config/serializer.rs +++ b/src/config/serializer.rs @@ -90,6 +90,7 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; use std::io::{Seek, SeekFrom}; use std::path::PathBuf; diff --git a/src/filetransfer/ftp_transfer.rs b/src/filetransfer/ftp_transfer.rs index 1a8bab3..2f8e4a6 100644 --- a/src/filetransfer/ftp_transfer.rs +++ b/src/filetransfer/ftp_transfer.rs @@ -775,6 +775,8 @@ mod tests { use super::*; use crate::utils::fmt::fmt_time; + + use pretty_assertions::assert_eq; use std::time::Duration; #[test] diff --git a/src/filetransfer/mod.rs b/src/filetransfer/mod.rs index ba3c489..a5d51f0 100644 --- a/src/filetransfer/mod.rs +++ b/src/filetransfer/mod.rs @@ -332,6 +332,7 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; use std::str::FromStr; use std::string::ToString; diff --git a/src/filetransfer/scp_transfer.rs b/src/filetransfer/scp_transfer.rs index 5de40a3..fdc9d5e 100644 --- a/src/filetransfer/scp_transfer.rs +++ b/src/filetransfer/scp_transfer.rs @@ -885,6 +885,7 @@ impl FileTransfer for ScpFileTransfer { mod tests { use super::*; + use pretty_assertions::assert_eq; #[test] fn test_filetransfer_scp_new() { diff --git a/src/filetransfer/sftp_transfer.rs b/src/filetransfer/sftp_transfer.rs index 2ad5947..28dfdca 100644 --- a/src/filetransfer/sftp_transfer.rs +++ b/src/filetransfer/sftp_transfer.rs @@ -702,6 +702,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_filetransfer_sftp_new() { let client: SftpFileTransfer = SftpFileTransfer::new(SshKeyStorage::empty()); diff --git a/src/fs/explorer/builder.rs b/src/fs/explorer/builder.rs index d088d23..9ba2dce 100644 --- a/src/fs/explorer/builder.rs +++ b/src/fs/explorer/builder.rs @@ -117,6 +117,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_fs_explorer_builder_new_default() { let explorer: FileExplorer = FileExplorerBuilder::new().build(); diff --git a/src/fs/explorer/formatter.rs b/src/fs/explorer/formatter.rs index 6294c6c..68a5c0a 100644 --- a/src/fs/explorer/formatter.rs +++ b/src/fs/explorer/formatter.rs @@ -539,6 +539,8 @@ mod tests { use super::*; use crate::fs::{FsDirectory, FsFile}; + + use pretty_assertions::assert_eq; use std::path::PathBuf; use std::time::SystemTime; diff --git a/src/fs/explorer/mod.rs b/src/fs/explorer/mod.rs index afc5f8c..ec90def 100644 --- a/src/fs/explorer/mod.rs +++ b/src/fs/explorer/mod.rs @@ -361,6 +361,7 @@ mod tests { use crate::fs::{FsDirectory, FsFile}; use crate::utils::fmt::fmt_time; + use pretty_assertions::assert_eq; use std::thread::sleep; use std::time::{Duration, SystemTime}; diff --git a/src/fs/mod.rs b/src/fs/mod.rs index e82e91d..84ca480 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -232,6 +232,7 @@ impl FsEntry { mod tests { use super::*; + use pretty_assertions::assert_eq; #[test] fn test_fs_fsentry_dir() { diff --git a/src/host/mod.rs b/src/host/mod.rs index a3074a2..dcb6162 100644 --- a/src/host/mod.rs +++ b/src/host/mod.rs @@ -739,6 +739,8 @@ impl Localhost { mod tests { use super::*; + + use pretty_assertions::assert_eq; use std::fs::File; use std::io::Write; diff --git a/src/system/bookmarks_client.rs b/src/system/bookmarks_client.rs index 873ae9a..530aea8 100644 --- a/src/system/bookmarks_client.rs +++ b/src/system/bookmarks_client.rs @@ -372,6 +372,8 @@ impl BookmarksClient { mod tests { use super::*; + + use pretty_assertions::assert_eq; use std::thread::sleep; use std::time::Duration; diff --git a/src/system/config_client.rs b/src/system/config_client.rs index 532f1a9..d85decf 100644 --- a/src/system/config_client.rs +++ b/src/system/config_client.rs @@ -381,6 +381,7 @@ mod tests { use crate::config::UserConfig; use crate::utils::random::random_alphanumeric_with_len; + use pretty_assertions::assert_eq; use std::io::Read; #[test] diff --git a/src/system/environment.rs b/src/system/environment.rs index 44d2b59..619c679 100644 --- a/src/system/environment.rs +++ b/src/system/environment.rs @@ -92,6 +92,7 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; use std::fs::{File, OpenOptions}; use std::io::Write; diff --git a/src/system/keys/filestorage.rs b/src/system/keys/filestorage.rs index da2e046..074ffa3 100644 --- a/src/system/keys/filestorage.rs +++ b/src/system/keys/filestorage.rs @@ -125,6 +125,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_system_keys_filestorage_make_dir() { let storage: FileStorage = FileStorage::new(&Path::new("/tmp/")); diff --git a/src/system/keys/keyringstorage.rs b/src/system/keys/keyringstorage.rs index 3e0c46e..5fae681 100644 --- a/src/system/keys/keyringstorage.rs +++ b/src/system/keys/keyringstorage.rs @@ -104,6 +104,7 @@ mod tests { extern crate whoami; use super::*; + use pretty_assertions::assert_eq; use whoami::username; #[test] diff --git a/src/system/keys/mod.rs b/src/system/keys/mod.rs index c15510b..4933a8e 100644 --- a/src/system/keys/mod.rs +++ b/src/system/keys/mod.rs @@ -78,6 +78,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_system_keys_mod_errors() { assert_eq!( diff --git a/src/system/sshkey_storage.rs b/src/system/sshkey_storage.rs index d65b848..fe5b4a1 100644 --- a/src/system/sshkey_storage.rs +++ b/src/system/sshkey_storage.rs @@ -88,8 +88,9 @@ impl SshKeyStorage { mod tests { use super::*; - use crate::system::config_client::ConfigClient; + + use pretty_assertions::assert_eq; use std::path::Path; #[test] diff --git a/src/ui/components/bookmark_list.rs b/src/ui/components/bookmark_list.rs index a0824d2..a541db7 100644 --- a/src/ui/components/bookmark_list.rs +++ b/src/ui/components/bookmark_list.rs @@ -333,6 +333,8 @@ impl Component for BookmarkList { mod tests { use super::*; + + use pretty_assertions::assert_eq; use tuirealm::event::KeyEvent; #[test] diff --git a/src/ui/components/file_list.rs b/src/ui/components/file_list.rs index 31659f5..105c084 100644 --- a/src/ui/components/file_list.rs +++ b/src/ui/components/file_list.rs @@ -345,6 +345,8 @@ impl Component for FileList { mod tests { use super::*; + + use pretty_assertions::assert_eq; use tuirealm::event::KeyEvent; #[test] diff --git a/src/ui/components/logbox.rs b/src/ui/components/logbox.rs index e72f6af..b6159e0 100644 --- a/src/ui/components/logbox.rs +++ b/src/ui/components/logbox.rs @@ -297,6 +297,8 @@ impl Component for LogBox { mod tests { use super::*; + + use pretty_assertions::assert_eq; use tuirealm::event::{KeyCode, KeyEvent}; use tuirealm::props::{TableBuilder, TextSpan}; use tuirealm::tui::style::Color; diff --git a/src/ui/components/msgbox.rs b/src/ui/components/msgbox.rs index e61d5f7..8b21152 100644 --- a/src/ui/components/msgbox.rs +++ b/src/ui/components/msgbox.rs @@ -210,6 +210,8 @@ impl Component for MsgBox { mod tests { use super::*; + + use pretty_assertions::assert_eq; use tuirealm::event::{KeyCode, KeyEvent}; use tuirealm::props::{TextSpan, TextSpanBuilder}; use tuirealm::tui::style::Color; diff --git a/src/ui/context.rs b/src/ui/context.rs index 0c0e55c..1199aed 100644 --- a/src/ui/context.rs +++ b/src/ui/context.rs @@ -163,6 +163,8 @@ impl Default for FileTransferParams { mod tests { use super::*; + + use pretty_assertions::assert_eq; use std::path::PathBuf; #[test] diff --git a/src/ui/store.rs b/src/ui/store.rs index 185654a..5d49d0f 100644 --- a/src/ui/store.rs +++ b/src/ui/store.rs @@ -175,6 +175,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_ui_store() { // Create store diff --git a/src/utils/crypto.rs b/src/utils/crypto.rs index 45314d7..a7a54e6 100644 --- a/src/utils/crypto.rs +++ b/src/utils/crypto.rs @@ -52,6 +52,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_utils_crypto_aes128() { let key: &str = "MYSUPERSECRETKEY"; diff --git a/src/utils/fmt.rs b/src/utils/fmt.rs index 9e8a636..202cdf3 100644 --- a/src/utils/fmt.rs +++ b/src/utils/fmt.rs @@ -157,6 +157,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_utils_fmt_pex() { assert_eq!(fmt_pex(7, 7, 7), String::from("rwxrwxrwx")); diff --git a/src/utils/parser.rs b/src/utils/parser.rs index 54fa7bc..b5a8f41 100644 --- a/src/utils/parser.rs +++ b/src/utils/parser.rs @@ -233,6 +233,8 @@ mod tests { use super::*; use crate::utils::fmt::fmt_time; + use pretty_assertions::assert_eq; + #[test] fn test_utils_parse_remote_opt() { // Base case diff --git a/src/utils/random.rs b/src/utils/random.rs index 7a0010c..0cc2ad5 100644 --- a/src/utils/random.rs +++ b/src/utils/random.rs @@ -47,6 +47,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_utils_random_alphanumeric_with_len() { assert_eq!(random_alphanumeric_with_len(256).len(), 256); diff --git a/src/utils/ui.rs b/src/utils/ui.rs index 9d7f60a..43cf147 100644 --- a/src/utils/ui.rs +++ b/src/utils/ui.rs @@ -60,6 +60,8 @@ mod tests { use super::*; + use pretty_assertions::assert_eq; + #[test] fn test_utils_ui_draw_area_in() { let area: Rect = Rect::new(0, 0, 1024, 512);