mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
fmt
This commit is contained in:
@@ -20,10 +20,10 @@ pub fn aes128_b64_decrypt(key: &str, secret: &str) -> Result<String, magic_crypt
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_utils_crypto_aes128() {
|
||||
let key: &str = "MYSUPERSECRETKEY";
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
//!
|
||||
//! `file` is the module which exposes file related utilities
|
||||
|
||||
use std::fs::File;
|
||||
use std::fs::OpenOptions;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
//!
|
||||
//! `fmt` is the module which provides utilities for formatting
|
||||
|
||||
use remotefs::fs::UnixPexClass;
|
||||
|
||||
use chrono::prelude::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use chrono::prelude::*;
|
||||
use remotefs::fs::UnixPexClass;
|
||||
use tuirealm::tui::style::Color;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
@@ -271,10 +271,10 @@ pub fn fmt_bytes(v: u64) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_utils_fmt_pex() {
|
||||
assert_eq!(fmt_pex(UnixPexClass::from(7)), String::from("rwx"));
|
||||
|
||||
@@ -3,23 +3,22 @@
|
||||
//! `parser` is the module which provides utilities for parsing different kind of stuff
|
||||
|
||||
// Locals
|
||||
use crate::filetransfer::{
|
||||
params::{AwsS3Params, GenericProtocolParams, ProtocolParams},
|
||||
FileTransferParams, FileTransferProtocol,
|
||||
};
|
||||
#[cfg(not(test))] // NOTE: don't use configuration during tests
|
||||
use crate::system::config_client::ConfigClient;
|
||||
#[cfg(not(test))] // NOTE: don't use configuration during tests
|
||||
use crate::system::environment;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
// Ext
|
||||
use bytesize::ByteSize;
|
||||
use lazy_regex::{Lazy, Regex};
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use tuirealm::tui::style::Color;
|
||||
use tuirealm::utils::parser as tuirealm_parser;
|
||||
|
||||
use crate::filetransfer::params::{AwsS3Params, GenericProtocolParams, ProtocolParams};
|
||||
use crate::filetransfer::{FileTransferParams, FileTransferProtocol};
|
||||
#[cfg(not(test))] // NOTE: don't use configuration during tests
|
||||
use crate::system::config_client::ConfigClient;
|
||||
#[cfg(not(test))] // NOTE: don't use configuration during tests
|
||||
use crate::system::environment;
|
||||
|
||||
// Regex
|
||||
|
||||
/**
|
||||
@@ -314,10 +313,10 @@ pub fn parse_bytesize<S: AsRef<str>>(bytes: S) -> Option<ByteSize> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_utils_parse_remote_opt() {
|
||||
// Base case
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
//! `random` is the module which provides utilities for rand
|
||||
|
||||
// Ext
|
||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::{thread_rng, Rng};
|
||||
|
||||
/// Generate a random alphanumeric string with provided length
|
||||
pub fn random_alphanumeric_with_len(len: usize) -> String {
|
||||
@@ -18,10 +19,10 @@ pub fn random_alphanumeric_with_len(len: usize) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_utils_random_alphanumeric_with_len() {
|
||||
assert_eq!(random_alphanumeric_with_len(256).len(), 256);
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
//!
|
||||
//! contains helper functions for tests
|
||||
|
||||
use remotefs::fs::{File, FileType, Metadata};
|
||||
// ext
|
||||
use std::fs::File as StdFile;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use remotefs::fs::{File, FileType, Metadata};
|
||||
use tempfile::NamedTempFile;
|
||||
|
||||
pub fn create_sample_file_entry() -> (File, NamedTempFile) {
|
||||
@@ -74,10 +75,10 @@ pub fn create_file_ioers(p: &Path) -> (StdFile, StdFile) {
|
||||
}
|
||||
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_utils_test_helpers_sample_file() {
|
||||
let _ = create_sample_file_entry();
|
||||
|
||||
@@ -57,10 +57,10 @@ impl Popup {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_utils_ui_draw_area_in() {
|
||||
let area: Rect = Rect::new(0, 0, 1024, 512);
|
||||
|
||||
Reference in New Issue
Block a user