From 75f4722ddb32bf7c9ca89ab3355035977961a412 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Fri, 16 Sep 2022 21:38:46 -0500 Subject: [PATCH] gitstat update Helptext update and test suite added. --- core/gitstat | 2 +- core/test/gitstat.bats | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 core/test/gitstat.bats diff --git a/core/gitstat b/core/gitstat index 6199667..9351e04 100755 --- a/core/gitstat +++ b/core/gitstat @@ -5,7 +5,7 @@ version="1.0" usage_message="Usage: gitstat" help_message=$(/usr/bin/cat <<-EOF Fetch updates in git repositories - Usage: ctdir TARGETS [..] [OPTIONS] + Usage: gitstat Options: -h, --help print this message and exit -v, --version print version number and exit diff --git a/core/test/gitstat.bats b/core/test/gitstat.bats new file mode 100644 index 0000000..2a390fd --- /dev/null +++ b/core/test/gitstat.bats @@ -0,0 +1,39 @@ +#!/usr/bin/env bats +bats_require_minimum_version 1.5.0 + +@test "gitstat version" { + run --separate-stderr gitstat --version + [ "$status" -eq 0 ] + [ "$output" = "gitstat 1.0" ] + [ "$stderr" = "" ] +} + +@test "gitstat version short" { + run --separate-stderr gitstat -v + [ "$status" -eq 0 ] + [ "$output" = "gitstat 1.0" ] + [ "$stderr" = "" ] +} + +@test "gitstat help" { + run --separate-stderr gitstat --help + [ "$status" -eq 0 ] + [ "${lines[0]}" = "Fetch updates in git repositories" ] + [ "${lines[1]}" = "Usage: gitstat" ] + [ "${lines[2]}" = "Options:" ] + [ "${lines[3]}" = " -h, --help print this message and exit" ] + [ "${lines[4]}" = " -v, --version print version number and exit" ] + [ "$stderr" = "" ] +} + +@test "gitstat help short" { + run --separate-stderr gitstat -h + [ "$status" -eq 0 ] + [ "${lines[0]}" = "Fetch updates in git repositories" ] + [ "${lines[1]}" = "Usage: gitstat" ] + [ "${lines[2]}" = "Options:" ] + [ "${lines[3]}" = " -h, --help print this message and exit" ] + [ "${lines[4]}" = " -v, --version print version number and exit" ] + [ "$stderr" = "" ] +} + -- 2.45.2