summaryrefslogtreecommitdiff
path: root/test/cases/gitget.bats
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-10-01 20:22:32 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-10-01 20:31:57 -0400
commit00406ddaa210e0e9a6e31e0e6841b51edabc80fb (patch)
tree8ebedf77a90d8d662f828fcd04f55aa7d7b16ecc /test/cases/gitget.bats
parentf2294c82afae36bbd5772a86c6689fd4c12c50f0 (diff)
(BATS) test/cases: Automated Roundup→BATS conversion
for file in test/cases/*.bats; do name=$(sed -n 's/^describe //p' -- "$file") sed -ri ' # Remove the roundup shebang /^#!\/usr\/bin\/env roundup$/d # Use $BATS_TEST_NAME instead of $roundup_test_name s,roundup_test_name,BATS_TEST_NAME,g # Use BATS built-in "skip" instead of just succeeding /^\trequire /s/\|\| return 0$/|| skip/ # Remove the chroot message, does not play well with BATS output /Creating a chroot, may take a few minutes/d # Update file locations s,^\. \./test-common\.sh$,load ../lib/common, s,\b(libre(chroot|dbdiff|fetch|makepkg|stage|xgettext)|pkgbuild-check-nonfree|toru)\.d\b,fixtures/\1,g # In BATS, the hook is setup(), not before() s,^before\(\),setup(), s,^\tcommon_before$,\tcommon_setup, # Convert test definitions from # describe FOO # it_does_a_thing() { … } # to # @test "FOO does a thing" { … } /^describe /d /^it_/ { s/_/ /g s,^it (.*)\(\),@test "'"$name"' \1\", } ' \ -- "$file" # Remove leading newline that might have been left behind by the above sed -i '1{/^$/d}' -- "$file" git add "$file" done sed -i \ -e 's,librexgettext\.d,fixtures/librexgettext,g' \ -e 's,/it_,/test_librexgettext_,g' \ -- test/fixtures/librexgettext/* git add test/fixtures/librexgettext/*
Diffstat (limited to 'test/cases/gitget.bats')
-rw-r--r--test/cases/gitget.bats11
1 files changed, 4 insertions, 7 deletions
diff --git a/test/cases/gitget.bats b/test/cases/gitget.bats
index 1630fdb..034075e 100644
--- a/test/cases/gitget.bats
+++ b/test/cases/gitget.bats
@@ -1,16 +1,13 @@
-#!/usr/bin/env roundup
+load ../lib/common
-describe gitget
-. ./test-common.sh
-
-it_displays_help() {
+@test "gitget displays help" {
LC_ALL=C gitget -h >$tmpdir/stdout 2>$tmpdir/stderr
[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
empty $tmpdir/stderr
}
-it_fails_with_0_args() {
+@test "gitget fails with 0 args" {
gitget >$tmpdir/stdout 2>$tmpdir/stderr || status=$?
[[ $status != 0 ]]
@@ -18,7 +15,7 @@ it_fails_with_0_args() {
not empty $tmpdir/stderr
}
-it_forces_url_for_bare() {
+@test "gitget forces url for bare" {
mkdir "$tmpdir/src"
cd "$tmpdir/src"
git init .