From 988d3f0d65058a5e39971ca1f5bc7c8ee43264c3 Mon Sep 17 00:00:00 2001 From: Adriaan Knapen Date: Tue, 2 Feb 2021 07:51:58 +0900 Subject: [PATCH] test(option): Include test cases --- wait-for.bats | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wait-for.bats b/wait-for.bats index cbea6a4..e5ff462 100644 --- a/wait-for.bats +++ b/wait-for.bats @@ -12,3 +12,23 @@ [ "$status" -ne 0 ] [ "$output" != "success" ] } + +@test "support condensed option style" { + run ./wait-for -qt1 google.com:80 -- echo 'success' + + [ "$output" = "success" ] +} + +@test "timeout cannot be negative" { + run ./wait-for -t -1 google.com:80 -- echo 'success' + + [ "$status" -ne 0 ] + [ "$output" != "success" ] +} + +@test "timeout cannot be empty" { + run ./wait-for -t -- google.com:80 -- echo 'success' + + [ "$status" -ne 0 ] + [ "$output" != "success" ] +}