add test for ftw help

This commit is contained in:
Michael Angelo Calimlim 2023-11-02 21:28:11 +08:00
parent 220c2e459a
commit 3e6b03d3df

25
tests/test_ftw_help.rs Normal file
View file

@ -0,0 +1,25 @@
mod common;
use assert_cmd::prelude::*;
use clap::{crate_authors, crate_description, crate_name, crate_version};
use common::ftw;
use predicates;
use predicates::prelude::*;
#[test]
fn test_ftw_help() {
let crate_authors = crate_authors!();
let crate_description = crate_description!();
let crate_name = crate_name!();
let crate_version = crate_version!();
let name_version = format!("{crate_name} {crate_version}");
let usage = format!("Usage: {crate_name} [COMMAND]");
ftw()
.arg("--help")
.assert()
.success()
.stdout(predicates::str::contains(name_version).from_utf8())
.stdout(predicates::str::contains(crate_description).from_utf8())
.stdout(predicates::str::contains(crate_authors).from_utf8())
.stdout(predicates::str::contains(usage).from_utf8());
}