diff options
Diffstat (limited to '')
-rwxr-xr-x | t/website.bats | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/t/website.bats b/t/website.bats index d10b39d..5bbfb59 100755 --- a/t/website.bats +++ b/t/website.bats @@ -9,15 +9,15 @@ cd "$BATS_TEST_DIRNAME/../" @test "Help: show short usage when no subcommand is given, exit code is 2" { run ./website [[ "$status" -eq 2 ]] - [[ "${lines[0]}" = "Usage:" ]] - [[ "${lines[-1]}" = "Missing subcommand." ]] + [[ "${lines[0]}" =~ "Missing subcommand." ]] + [[ "${lines[1]}" = "Usage:" ]] } @test "Help: show short usage for unknown subcommand, exit code is 2" { run ./website bad-subcommand [[ "$status" -eq 2 ]] - [[ "${lines[0]}" = "Usage:" ]] - [[ "${lines[-1]}" = "Unknown subcommand: bad-subcommand." ]] + [[ "${lines[0]}" =~ "Unknown subcommand: bad-subcommand." ]] + [[ "${lines[1]}" = "Usage:" ]] } @test "Help: show full toplevel help" { @@ -32,10 +32,12 @@ cd "$BATS_TEST_DIRNAME/../" @test "Help: show short subcommand usage when subcommand isn't invoked properly, exit code is 2" { run ./website pastebin [[ "$status" -eq 2 ]] - [[ "${lines[0]}" = "Missing required --title argument." ]] + [[ "${lines[0]}" =~ "Missing required --title argument." ]] + [[ "${lines[1]}" = "Usage:" ]] run ./website slides [[ "$status" -eq 2 ]] - [[ "${lines[0]}" = "Missing required --name argument." ]] + [[ "${lines[0]}" =~ "Missing required --name argument." ]] + [[ "${lines[1]}" = "Usage:" ]] } @test "Help: show subcommand manpage" { @@ -57,4 +59,12 @@ cd "$BATS_TEST_DIRNAME/../" run ./website pastebin --title [[ "$status" = 2 ]] [[ "${lines[0]}" = "Option title requires an argument" ]] + [[ "${lines[1]}" = "Usage:" ]] +} + +@test "Slides: required input for --name" { + run ./website slides --name + [[ "$status" = 2 ]] + [[ "${lines[0]}" = "Option name requires an argument" ]] + [[ "${lines[1]}" = "Usage:" ]] } |