~dricottone/my-utils

75f4722ddb32bf7c9ca89ab3355035977961a412 — Dominic Ricottone 2 years ago 94d53f4
gitstat update

Helptext update and test suite added.
2 files changed, 40 insertions(+), 1 deletions(-)

M core/gitstat
A core/test/gitstat.bats
M core/gitstat => core/gitstat +1 -1
@@ 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

A core/test/gitstat.bats => core/test/gitstat.bats +39 -0
@@ 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" = "" ]
}