summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-05-25 19:57:48 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-06-09 15:12:32 +0200
commit8ba17539a3ec33abc283ca382cca6e59876a0f07 (patch)
treeb8feb5b0df9013bde28c487be34d5d8ba7b38307 /test
parent991e690a693cf3724b815c1fb358aa033af73c03 (diff)
fix support for multiple patterns in apt-cache search
Patterns can appear in the name as well as in the description, they don't have to match all in the name/description only. Closes: 691453
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework12
-rwxr-xr-xtest/integration/test-bug-691453-apt-cache-search-multi-pattern33
2 files changed, 42 insertions, 3 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 31b12e8bf..e3e868d45 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -483,6 +483,7 @@ insertpackage() {
local VERSION="$4"
local DEPENDENCIES="$5"
local PRIORITY="${6:-optional}"
+ local DESCRIPTION="${7}"
local ARCHS=""
for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
@@ -504,11 +505,16 @@ Maintainer: Joe Sixpack <joe@example.org>" >> $FILE
echo "Version: $VERSION
Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ echo -n 'Description: ' >> $FILE
+ if [ -z "$DESCRIPTION" ]; then
+ echo "an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other proposeā€¦
-" >> $FILE
+ und used only by testcases for APT and surf no other proposeā€¦" >> $FILE
+ else
+ echo "$DESCRIPTION" >> $FILE
+ fi
+ echo >> $FILE
done
done
}
diff --git a/test/integration/test-bug-691453-apt-cache-search-multi-pattern b/test/integration/test-bug-691453-apt-cache-search-multi-pattern
new file mode 100755
index 000000000..0367892fc
--- /dev/null
+++ b/test/integration/test-bug-691453-apt-cache-search-multi-pattern
@@ -0,0 +1,33 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'native'
+
+insertpackage 'unstable' 'foobar' 'native' '1' '' '' 'funky tool'
+insertpackage 'unstable' 'coolstuff' 'native' '1' '' '' 'funky tool just like foo and bar'
+insertpackage 'unstable' 'foo' 'native' '1' '' '' 'tool best used with bar'
+insertpackage 'unstable' 'bar' 'native' '1' '' '' 'tool best used with foo'
+insertpackage 'unstable' 'baz' 'native' '1' 'Provides: bar' '' 'alternative tool best used with foo'
+
+setupaptarchive
+
+# in this special case the following queries should be equal
+FOOBAR='foobar - funky tool
+coolstuff - funky tool just like foo and bar
+foo - tool best used with bar
+bar - tool best used with foo
+baz - alternative tool best used with foo'
+
+testequal "$FOOBAR" aptcache search foo
+testequal "$FOOBAR" aptcache search bar
+testequal "$FOOBAR" aptcache search foo bar
+
+testequal 'foobar - funky tool
+foo - tool best used with bar' aptcache search -n foo
+testequal 'foobar - funky tool
+bar - tool best used with foo
+baz - alternative tool best used with foo' aptcache search -n bar
+testequal 'foobar - funky tool' aptcache search -n foo bar