mirror of
https://github.com/uutils/tar.git
synced 2026-06-10 16:14:35 -07:00
Test required script argument
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use clap::{arg, Arg, Command};
|
||||
//use clap::builder::OsStr;
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use uucore::{error::UResult, format_usage};
|
||||
|
||||
@@ -12,6 +14,8 @@ const USAGE: &str = "sed [OPTION]... {singular-script} [input-file]...";
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
// Skip binary name
|
||||
let args: Vec<OsString> = args.skip(1).collect();
|
||||
// TODO remove underscore prefix when var is used
|
||||
let _matches = uu_app().try_get_matches_from(args)?;
|
||||
// TODO
|
||||
|
||||
@@ -11,6 +11,20 @@ fn test_invalid_arg() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sed() {
|
||||
new_ucmd!().succeeds();
|
||||
fn test_debug() {
|
||||
new_ucmd!().arg("--debug").arg("").succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_missing_script_argument() {
|
||||
new_ucmd!()
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains("the following required arguments were not provided")
|
||||
.stderr_contains("<script>");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_required_script_argument() {
|
||||
new_ucmd!().arg("").succeeds().code_is(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user