summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-04-25 06:50:00 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2017-04-25 07:00:23 +0200
commit90ab7c7b838a706ae7f4e63f95ccdc706ce10977 (patch)
tree2f39c0ae3a55a149b9562c9c9e23bf4c1cc72baa
parent4be9aa6350430703383b9df26be2aa37ce840cdc (diff)
downloadaur-90ab7c7b838a706ae7f4e63f95ccdc706ce10977.tar.gz
aur-90ab7c7b838a706ae7f4e63f95ccdc706ce10977.tar.xz
t1300: Factor out package dumping
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-xtest/t1300-git-update.sh36
1 files changed, 12 insertions, 24 deletions
diff --git a/test/t1300-git-update.sh b/test/t1300-git-update.sh
index a65ca3a1..dbe60292 100755
--- a/test/t1300-git-update.sh
+++ b/test/t1300-git-update.sh
@@ -4,6 +4,14 @@ test_description='git-update tests'
. ./setup.sh
+dump_package_info() {
+ for t in Packages Licenses PackageLicenses Groups PackageGroups \
+ PackageDepends PackageRelations PackageSources \
+ PackageNotifications; do
+ echo "SELECT * FROM $t;" | sqlite3 aur.db
+ done
+}
+
test_expect_success 'Test update hook on a fresh repository.' '
old=0000000000000000000000000000000000000000 &&
new=$(git -C aur.git rev-parse HEAD^) &&
@@ -16,12 +24,7 @@ test_expect_success 'Test update hook on a fresh repository.' '
1|1|python-pygit2||
1|1
EOF
- >actual &&
- for t in Packages Licenses PackageLicenses Groups PackageGroups \
- PackageDepends PackageRelations PackageSources \
- PackageNotifications; do
- echo "SELECT * FROM $t;" | sqlite3 aur.db >>actual
- done &&
+ dump_package_info >actual &&
test_cmp expected actual
'
@@ -44,12 +47,7 @@ test_expect_success 'Test update hook on another fresh repository.' '
1|1
2|1
EOF
- >actual &&
- for t in Packages Licenses PackageLicenses Groups PackageGroups \
- PackageDepends PackageRelations PackageSources \
- PackageNotifications; do
- echo "SELECT * FROM $t;" | sqlite3 aur.db >>actual
- done &&
+ dump_package_info >actual &&
test_cmp expected actual
'
@@ -70,12 +68,7 @@ test_expect_success 'Test update hook on an updated repository.' '
1|1
2|1
EOF
- >actual &&
- for t in Packages Licenses PackageLicenses Groups PackageGroups \
- PackageDepends PackageRelations PackageSources \
- PackageNotifications; do
- echo "SELECT * FROM $t;" | sqlite3 aur.db >>actual
- done &&
+ dump_package_info >actual &&
test_cmp expected actual
'
@@ -94,12 +87,7 @@ test_expect_success 'Test restore mode.' '
1|1
2|1
EOF
- >actual &&
- for t in Packages Licenses PackageLicenses Groups PackageGroups \
- PackageDepends PackageRelations PackageSources \
- PackageNotifications; do
- echo "SELECT * FROM $t;" | sqlite3 aur.db >>actual
- done &&
+ dump_package_info >actual &&
test_cmp expected actual
'