serial test for env paths

This commit is contained in:
veeso 2021-11-20 09:42:13 +01:00
parent 18c30e5814
commit 17a4efe80d
6 changed files with 34 additions and 3 deletions

View File

@ -19,4 +19,4 @@ jobs:
/tmp/rustup.sh -y
. $HOME/.cargo/env
cargo build --no-default-features
cargo test --no-default-features --verbose --features github-actions -- --test-threads 1
cargo test --no-default-features --verbose --features github-actions

View File

@ -14,6 +14,6 @@ jobs:
- name: Build
run: cargo build
- name: Run tests
run: cargo test --verbose --features github-actions -- --test-threads 1
run: cargo test --verbose --features github-actions
- name: Clippy
run: cargo clippy -- -Dwarnings

View File

@ -14,6 +14,6 @@ jobs:
- name: Build
run: cargo build
- name: Run tests
run: cargo test --verbose --features github-actions -- --test-threads 1
run: cargo test --verbose --features github-actions
- name: Clippy
run: cargo clippy -- -Dwarnings

23
Cargo.lock generated
View File

@ -1970,6 +1970,28 @@ dependencies = [
"serde",
]
[[package]]
name = "serial_test"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
dependencies = [
"lazy_static",
"parking_lot 0.11.2",
"serial_test_derive",
]
[[package]]
name = "serial_test_derive"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
dependencies = [
"proc-macro2",
"quote 1.0.9",
"syn 1.0.76",
]
[[package]]
name = "sha2"
version = "0.9.8"
@ -2201,6 +2223,7 @@ dependencies = [
"rust-s3",
"self_update",
"serde",
"serial_test",
"simplelog",
"ssh2",
"suppaftp",

View File

@ -67,6 +67,7 @@ wildmatch = "2.0.0"
[dev-dependencies]
pretty_assertions = "0.7.2"
serial_test = "^0.5.1"
[features]
default = [ "with-keyring" ]

View File

@ -110,10 +110,12 @@ mod tests {
use super::*;
use pretty_assertions::assert_eq;
use serial_test::serial;
use std::fs::{File, OpenOptions};
use std::io::Write;
#[test]
#[serial]
fn test_system_environment_get_config_dir() {
// Create and get conf_dir
let conf_dir: PathBuf = init_config_dir().ok().unwrap().unwrap();
@ -122,6 +124,7 @@ mod tests {
}
#[test]
#[serial]
fn test_system_environment_get_config_dir_err() {
let mut conf_dir: PathBuf = std::env::temp_dir();
conf_dir.push("termscp");
@ -143,6 +146,7 @@ mod tests {
}
#[test]
#[serial]
fn test_system_environment_get_bookmarks_paths() {
assert_eq!(
get_bookmarks_paths(&Path::new("/home/omar/.config/termscp/")),
@ -151,6 +155,7 @@ mod tests {
}
#[test]
#[serial]
fn test_system_environment_get_config_paths() {
assert_eq!(
get_config_paths(&Path::new("/home/omar/.config/termscp/")),
@ -162,6 +167,7 @@ mod tests {
}
#[test]
#[serial]
fn test_system_environment_get_log_paths() {
assert_eq!(
get_log_paths(&Path::new("/home/omar/.config/termscp/")),
@ -170,6 +176,7 @@ mod tests {
}
#[test]
#[serial]
fn test_system_environment_get_theme_path() {
assert_eq!(
get_theme_path(&Path::new("/home/omar/.config/termscp/")),