From d78ba6691ab8a4ad62ef26d0e057232f3f8360a0 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 12 Jun 2017 12:51:30 +0200 Subject: [PATCH] tests: new test case for gpiodetect Verify that we bail out if the user passes any non-option argument to gpiodetect. Signed-off-by: Bartosz Golaszewski --- tests/tests-gpiodetect.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/tests-gpiodetect.c b/tests/tests-gpiodetect.c index b39d551..8385beb 100644 --- a/tests/tests-gpiodetect.c +++ b/tests/tests-gpiodetect.c @@ -44,3 +44,18 @@ static void gpiodetect_simple(void) TEST_DEFINE(gpiodetect_simple, "tools: gpiodetect - simple", 0, { 4, 8, 16 }); + +static void gpiodetect_invalid_args(void) +{ + test_gpiotool_run("gpiodetect", "unused argument", (char *)NULL); + test_tool_wait(); + + TEST_ASSERT(test_tool_exited()); + TEST_ASSERT_EQ(test_tool_exit_status(), 1); + TEST_ASSERT_NULL(test_tool_stdout()); + TEST_ASSERT_NOT_NULL(test_tool_stderr()); + TEST_ASSERT_STR_CONTAINS(test_tool_stderr(), "unrecognized argument"); +} +TEST_DEFINE(gpiodetect_invalid_args, + "tools: gpiodetect - invalid arguments", + 0, { }); -- 2.30.2