From: Bartosz Golaszewski Date: Mon, 12 Jun 2017 10:51:30 +0000 (+0200) Subject: tests: new test case for gpiodetect X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d78ba6691ab8a4ad62ef26d0e057232f3f8360a0;p=qemu-gpiodev%2Flibgpiod.git 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 --- 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, { });