mirror of https://github.com/chipsenkbeil/distant
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
891 B
Rust
40 lines
891 B
Rust
use assert_fs::prelude::*;
|
|
use rstest::*;
|
|
|
|
use crate::cli::fixtures::*;
|
|
|
|
#[rstest]
|
|
#[test_log::test]
|
|
fn should_output_true_if_exists(ctx: DistantManagerCtx) {
|
|
let temp = assert_fs::TempDir::new().unwrap();
|
|
|
|
// Create file
|
|
let file = temp.child("file");
|
|
file.touch().unwrap();
|
|
|
|
// distant fs exists {path}
|
|
ctx.new_assert_cmd(["fs", "exists"])
|
|
.arg(file.to_str().unwrap())
|
|
.assert()
|
|
.success()
|
|
.stdout("true\n")
|
|
.stderr("");
|
|
}
|
|
|
|
#[rstest]
|
|
#[test_log::test]
|
|
fn should_output_false_if_not_exists(ctx: DistantManagerCtx) {
|
|
let temp = assert_fs::TempDir::new().unwrap();
|
|
|
|
// Don't create file
|
|
let file = temp.child("file");
|
|
|
|
// distant fs exists {path}
|
|
ctx.new_assert_cmd(["fs", "exists"])
|
|
.arg(file.to_str().unwrap())
|
|
.assert()
|
|
.success()
|
|
.stdout("false\n")
|
|
.stderr("");
|
|
}
|