From e44f29a02023ec87bcfa44bc229e7e5d9472151e Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Tue, 16 Feb 2016 02:17:04 -0500 Subject: [PATCH] basename: tests for bad inputs --- tests/basename.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/basename.rs b/tests/basename.rs index f59c62190..4399e4d9c 100644 --- a/tests/basename.rs +++ b/tests/basename.rs @@ -74,3 +74,19 @@ fn test_zero_param() { expect_successful_stdout(vec![zero_param, "-a", path, path], "baz\0baz\0"); } } + +#[test] +fn test_invalid_option() { + let path = "/foo/bar/baz"; + expect_error(vec!["-q", path], ""); +} + +#[test] +fn test_no_args() { + expect_error(vec![], ""); +} + +#[test] +fn test_too_many_args() { + expect_error(vec!["a", "b", "c"], ""); +}