diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-10-01 20:22:32 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-10-01 20:31:57 -0400 |
commit | 00406ddaa210e0e9a6e31e0e6841b51edabc80fb (patch) | |
tree | 8ebedf77a90d8d662f828fcd04f55aa7d7b16ecc /test/fixtures | |
parent | f2294c82afae36bbd5772a86c6689fd4c12c50f0 (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/fixtures')
3 files changed, 34 insertions, 34 deletions
diff --git a/test/fixtures/librexgettext/combine.pot b/test/fixtures/librexgettext/combine.pot index 80d066f..967a98b 100644 --- a/test/fixtures/librexgettext/combine.pot +++ b/test/fixtures/librexgettext/combine.pot @@ -1,15 +1,15 @@ -#: librexgettext.d/combine1.sh:4 +#: fixtures/librexgettext/combine1.sh:4 msgid "Flag a" msgstr "" -#: librexgettext.d/combine1.sh:5 +#: fixtures/librexgettext/combine1.sh:5 msgid "Flag b" msgstr "" -#: librexgettext.d/combine2.sh:4 +#: fixtures/librexgettext/combine2.sh:4 msgid "Flag 1" msgstr "" -#: librexgettext.d/combine2.sh:5 +#: fixtures/librexgettext/combine2.sh:5 msgid "Flag 2" msgstr "" diff --git a/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.pot b/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.pot index 0d76a49..9548695 100644 --- a/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.pot +++ b/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.pot @@ -1,40 +1,40 @@ -#: librexgettext.d/it_handles_librefetch_flags.sh:4 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:4 msgid "Settings:" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:5 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:5 msgid "Force create mode (don't download)" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:6 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:6 msgid "Force download mode (don't create)" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:7 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:7 msgid "FILE" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:7 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:7 msgid "Use an alternate build script (instead of 'PKGBUILD'). If an " "SRCBUILD exists in the same directory, it is used instead" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:10 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:10 msgid "Alternate modes:" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:11 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:11 msgid "Generate integrity checks for source files" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:12 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:12 msgid "Print the effective build script (SRCBUILD)" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:13 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:13 msgid "Generate and print the location of the effective makepkg script" msgstr "" -#: librexgettext.d/it_handles_librefetch_flags.sh:15 +#: fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh:15 msgid "Show this message" msgstr "" diff --git a/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.pot b/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.pot index cae2a17..714ebac 100644 --- a/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.pot +++ b/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.pot @@ -1,58 +1,58 @@ -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:4 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:4 msgid "Flag 1" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:4 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:6 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:7 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:8 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:9 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:10 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:11 -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:13 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:4 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:6 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:7 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:8 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:9 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:10 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:11 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:13 msgid "OPTARG" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:5 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:5 msgid "Flag 2" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:6 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:6 msgid "Flag 3" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:7 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:7 msgid "Flag 4" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:8 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:8 msgid "Flag 5" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:9 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:9 msgid "Flag 6" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:10 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:10 msgid "Flag 7" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:11 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:11 msgid "Flag 8" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:13 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:13 msgid "FLAG 1" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:14 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:14 msgid "FLAG 2" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:16 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:16 msgid "FLAG A" msgstr "" -#: librexgettext.d/it_handles_multiple_skipped_flags.sh:17 +#: fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh:17 msgid "FLAG B" msgstr "" |