From 65b3f6995f3884b4f59f1f72adfa1585a6782c8f Mon Sep 17 00:00:00 2001 From: southerntofu Date: Wed, 16 Sep 2020 15:48:00 +0200 Subject: [PATCH] test runs only selected tasks --- tests/git.bats | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/tests/git.bats b/tests/git.bats index b5deb2f..9e2e55d 100755 --- a/tests/git.bats +++ b/tests/git.bats @@ -103,15 +103,6 @@ function clean { [[ "$(cat /tmp/forgebuild-host)" = "default" ]] } -@test "forced run triggers task" { - $FORGEBUILD -b $FORGEBUILDDIR time - [ -f /tmp/forgebuild-time ] - TIME="$(cat /tmp/forgebuild-time)" - $FORGEBUILD -f -b $FORGEBUILDDIR time - NEWTIME="$(cat /tmp/forgebuild-time)" - [[ "$TIME" != "$NEWTIME" ]] -} - @test "can checkout to a specific branch/commit" { echo "branch" > $FORGEBUILDDIR/branch.checkout cd $GITREPO @@ -221,3 +212,28 @@ function setup_submodule { [[ "$TIME" != "$NEWTIME" ]] } + +# CLI arguments/flags + +@test "running specific tasks only runs those tasks" { + $FORGEBUILD -b $FORGEBUILDDIR time host + [ -f /tmp/forgebuild-time ] + [ -f /tmp/forgebuild-host ] + [ ! -f /tmp/forgebuild-branch ] +} + +@test "not specifying tasks runs all tasks" { + $FORGEBUILD -b $FORGEBUILDDIR + [ -f /tmp/forgebuild-time ] + [ -f /tmp/forgebuild-host ] + [ -f /tmp/forgebuild-branch ] +} + +@test "forced run triggers task" { + $FORGEBUILD -b $FORGEBUILDDIR time + [ -f /tmp/forgebuild-time ] + TIME="$(cat /tmp/forgebuild-time)" + $FORGEBUILD -f -b $FORGEBUILDDIR time + NEWTIME="$(cat /tmp/forgebuild-time)" + [[ "$TIME" != "$NEWTIME" ]] +}