aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/equery/tests')
-rw-r--r--src/equery/tests/common-functions.sh52
-rwxr-xr-xsrc/equery/tests/run-all-tests.sh12
-rw-r--r--src/equery/tests/test-belongs-help.out11
-rwxr-xr-xsrc/equery/tests/test-belongs.sh24
-rw-r--r--src/equery/tests/test-changes-help.out0
-rw-r--r--src/equery/tests/test-check-help.out3
-rwxr-xr-xsrc/equery/tests/test-check.sh39
-rw-r--r--src/equery/tests/test-depends-help.out8
-rwxr-xr-xsrc/equery/tests/test-depends.sh27
-rw-r--r--src/equery/tests/test-depgraph-help.out7
-rwxr-xr-xsrc/equery/tests/test-depgraph.sh27
-rw-r--r--src/equery/tests/test-files-help.out11
-rwxr-xr-xsrc/equery/tests/test-files.sh61
-rw-r--r--src/equery/tests/test-glsa-help.out0
-rw-r--r--src/equery/tests/test-hasuses-help.out9
-rw-r--r--src/equery/tests/test-help.out21
-rwxr-xr-xsrc/equery/tests/test-help.sh105
-rw-r--r--src/equery/tests/test-list-help.out9
-rwxr-xr-xsrc/equery/tests/test-list.sh40
-rw-r--r--src/equery/tests/test-size-help.out6
-rwxr-xr-xsrc/equery/tests/test-size.sh27
-rw-r--r--src/equery/tests/test-stats-help.out0
-rw-r--r--src/equery/tests/test-uses-help.out7
-rwxr-xr-xsrc/equery/tests/test-uses.sh39
-rw-r--r--src/equery/tests/test-which-help.out3
-rwxr-xr-xsrc/equery/tests/test-which.sh22
26 files changed, 570 insertions, 0 deletions
diff --git a/src/equery/tests/common-functions.sh b/src/equery/tests/common-functions.sh
new file mode 100644
index 0000000..f065a0a
--- /dev/null
+++ b/src/equery/tests/common-functions.sh
@@ -0,0 +1,52 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+function tempfilename() {
+ fn=$(date "+%s")
+ if [ ! -f ${fn}.tmp ] ; then
+ echo ${fn}.tmp
+ fi
+}
+
+function report_pass() {
+ printf "%-40s - passed\n" ${1}
+}
+
+function report_failure() {
+ printf "%-40s - FAILED!\n" ${1}
+}
+
+function assert_samefile() {
+ diff $2 $3 && report_pass $1 || report_failure $1
+}
+
+function assert_eq() {
+ if [ $2 -eq $3 ] ; then
+ report_pass $1
+ else
+ printf "FAIL: $2 ! -eq $3\n"
+ report_failure $1
+ fi
+}
+
+function assert_ge() {
+ if [ $2 -ge $3 ] ; then
+ report_pass $1
+ else
+ printf "FAIL: $2 ! -ge $3\n"
+ report_failure $1
+ fi
+}
+
+function assert_exists() {
+ if [ -f $2 ] ; then
+ report_pass $1
+ else
+ printf "FAIL: $2 does not exist\n"
+ report_failure $1
+ fi
+} \ No newline at end of file
diff --git a/src/equery/tests/run-all-tests.sh b/src/equery/tests/run-all-tests.sh
new file mode 100755
index 0000000..4fe2dfe
--- /dev/null
+++ b/src/equery/tests/run-all-tests.sh
@@ -0,0 +1,12 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+for x in belongs check depends depgraph files help list size uses which ; do
+ ./test-${x}.sh
+done
diff --git a/src/equery/tests/test-belongs-help.out b/src/equery/tests/test-belongs-help.out
new file mode 100644
index 0000000..0d2f583
--- /dev/null
+++ b/src/equery/tests/test-belongs-help.out
@@ -0,0 +1,11 @@
+List all packages owning a particular set of files
+
+Note: Normally, only one package will own a file. If multiple packages own the same file, it usually consitutes a problem, and should be reported.
+
+Syntax:
+ belongs <local-opts> filename
+<local-opts> is either of:
+ -c, --category cat - only search in category cat
+ -f, --full-regex - supplied query is a regex
+ -e, --earlyout - stop when first match is found
+
diff --git a/src/equery/tests/test-belongs.sh b/src/equery/tests/test-belongs.sh
new file mode 100755
index 0000000..bd0eac4
--- /dev/null
+++ b/src/equery/tests/test-belongs.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_belongs() {
+ equery belongs $(which gcc) > ${tmpfile}
+
+ x=$(grep "gcc-config" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_belongs
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-changes-help.out b/src/equery/tests/test-changes-help.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/equery/tests/test-changes-help.out
diff --git a/src/equery/tests/test-check-help.out b/src/equery/tests/test-check-help.out
new file mode 100644
index 0000000..1e6afcf
--- /dev/null
+++ b/src/equery/tests/test-check-help.out
@@ -0,0 +1,3 @@
+Check package's files against recorded MD5 sums and timestamps
+Syntax:
+ size pkgspec
diff --git a/src/equery/tests/test-check.sh b/src/equery/tests/test-check.sh
new file mode 100755
index 0000000..803299f
--- /dev/null
+++ b/src/equery/tests/test-check.sh
@@ -0,0 +1,39 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_check() {
+ equery check gcc > ${tmpfile}
+
+ x=$(grep "sys-devel/gcc" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "[0-9]+ out of [0-9]+" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+test_check_permissions() {
+ equery check sudo > ${tmpfile}
+
+ x=$(grep "app-admin/sudo" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "[0-9]+ out of [0-9]+" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_check
+test_check_permissions
+
+rm -f ${tmpfile}
diff --git a/src/equery/tests/test-depends-help.out b/src/equery/tests/test-depends-help.out
new file mode 100644
index 0000000..356cd53
--- /dev/null
+++ b/src/equery/tests/test-depends-help.out
@@ -0,0 +1,8 @@
+List all direct dependencies matching a query pattern
+Syntax:
+ depends <local-opts> pkgspec
+<local-opts> is either of:
+ -d, --direct - search direct dependencies only (default)
+ -D, --indirect - search indirect dependencies (VERY slow)
+ -i, --only-installed - search installed in installed packages only
+
diff --git a/src/equery/tests/test-depends.sh b/src/equery/tests/test-depends.sh
new file mode 100755
index 0000000..e46d614
--- /dev/null
+++ b/src/equery/tests/test-depends.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_depends() {
+# equery skel gcc > ${tmpfile}
+
+# x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+ true
+# assert_eq ${FUNCNAME} ${x} 1
+
+# x=$(grep "virtual/libc" ${tmpfile} | wc -l)
+# assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+#test_skel
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-depgraph-help.out b/src/equery/tests/test-depgraph-help.out
new file mode 100644
index 0000000..5b9fd22
--- /dev/null
+++ b/src/equery/tests/test-depgraph-help.out
@@ -0,0 +1,7 @@
+Display a dependency tree for a given package
+
+Syntax:
+ depgraph <local-opts> pkgspec
+<local-opts> is either of:
+ -U, --no-useflags - do not show USE flags
+ -l, --linear - do not use fancy formatting
diff --git a/src/equery/tests/test-depgraph.sh b/src/equery/tests/test-depgraph.sh
new file mode 100755
index 0000000..016bb37
--- /dev/null
+++ b/src/equery/tests/test-depgraph.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_depgraph() {
+ equery depgraph gcc > ${tmpfile}
+
+ x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+
+ x=$(grep "virtual/libc" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_depgraph
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-files-help.out b/src/equery/tests/test-files-help.out
new file mode 100644
index 0000000..846151f
--- /dev/null
+++ b/src/equery/tests/test-files-help.out
@@ -0,0 +1,11 @@
+List files owned by a particular package
+
+Syntax:
+ files <local-opts> <cat/>packagename<-version>
+
+Note: category and version parts are optional.
+
+<local-opts> is either of:
+ --timestamp - append timestamp
+ --md5sum - append md5sum
+ --type - prepend file type
diff --git a/src/equery/tests/test-files.sh b/src/equery/tests/test-files.sh
new file mode 100755
index 0000000..ad0a5ea
--- /dev/null
+++ b/src/equery/tests/test-files.sh
@@ -0,0 +1,61 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+strip_versioned_files() {
+ grep -v "/usr/share/doc"
+}
+
+test_files() {
+ equery files bash > ${tmpfile}
+
+ x=$(grep man ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 5
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 25
+}
+
+test_files_timestamp() {
+ equery files --timestamp bash > ${tmpfile}
+
+ x=$(grep "/bin/bash .*....-..-.. ..:..:.." ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} $x 1
+}
+
+test_files_md5sum() {
+ equery files --md5sum bash > ${tmpfile}
+
+ x=$(egrep "/bin/bash .*[0-9a-z]{30}" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} $x 1
+}
+
+test_files_type() {
+
+ equery files --type bash > ${tmpfile}
+
+ x=$(grep "file.*/bin/bash$" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} $x 1
+
+ x=$(grep "symlink.*/bin/rbash" ${tmpfile} | wc -l)
+ assert_eq ${FUNCNAME} $x 1
+
+ x=$(grep "dir.*/usr/share/man" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 1
+}
+
+# Run tests
+
+test_files
+test_files_timestamp
+test_files_md5sum
+test_files_type
+
+rm ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-glsa-help.out b/src/equery/tests/test-glsa-help.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/equery/tests/test-glsa-help.out
diff --git a/src/equery/tests/test-hasuses-help.out b/src/equery/tests/test-hasuses-help.out
new file mode 100644
index 0000000..1a05645
--- /dev/null
+++ b/src/equery/tests/test-hasuses-help.out
@@ -0,0 +1,9 @@
+List all packages with a particular USE flag
+Syntax:
+ list <local-opts> useflag
+<local-opts> is either of:
+ -i, --installed - search installed packages (default)
+ -I, --exclude-installed - do not search installed packages
+ -p, --portage-tree - also search in portage tree (/usr/portage)
+ -o, --overlay-tree - also search in overlay tree (/usr/local/portage /usr/local/overlays/gentoo-boblycat)
+
diff --git a/src/equery/tests/test-help.out b/src/equery/tests/test-help.out
new file mode 100644
index 0000000..26517f4
--- /dev/null
+++ b/src/equery/tests/test-help.out
@@ -0,0 +1,21 @@
+Usage: equery <global-opts> command <local-opts>
+where <global-opts> is one of
+ -q, --quiet - minimal output
+ -C, --nocolor - turn off colours
+ -h, --help - this help screen
+ -V, --version - display version info
+where command(short) is one of
+ belongs(b) <local-opts> files... - list all packages owning files...
+ changes(c) - not implemented yet
+ check(k) pkgspec - check MD5sums and timestamps of pkgspec's files
+ depends(d) <local-opts> pkgspec - list all direct dependencies matching pkgspec
+ depgraph(g) <local-opts> pkgspec - display a dependency tree for pkgspec
+ files(f) <local-opts> pkgspec - list files owned by pkgspec
+ glsa(a) - not implemented yet
+ hasuses(h) <local-opts> pkgspec - list all packages with useflag
+ list(l) <local-opts> pkgspec - list all packages matching pkgspec
+ size(s) <local-opts> pkgspec - print size of files contained in package pkgspec
+ stats(t) - not implemented yet
+ uses(u) <local-opts> pkgspec - display USE flags for pkgspec
+ which(w) pkgspec - print full path to ebuild for package pkgspec
+
diff --git a/src/equery/tests/test-help.sh b/src/equery/tests/test-help.sh
new file mode 100755
index 0000000..618aac1
--- /dev/null
+++ b/src/equery/tests/test-help.sh
@@ -0,0 +1,105 @@
+#! /bin/sh
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_equery_help() {
+ equery --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-help.out
+
+}
+
+test_belongs_help() {
+ equery belongs --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-belongs-help.out
+}
+
+test_changes_help() {
+ equery changes --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-changes-help.out
+}
+
+test_check_help() {
+ equery check --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-check-help.out
+}
+
+test_depends_help() {
+ equery depends --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-depends-help.out
+}
+
+test_depgraph_help() {
+ equery depgraph --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-depgraph-help.out
+}
+
+test_files_help() {
+ equery files --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-files-help.out
+}
+
+test_glsa_help() {
+ equery glsa --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-glsa-help.out
+}
+
+test_hasuses_help() {
+ equery hasuses --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-hasuses-help.out
+}
+
+test_list_help() {
+ equery list --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-list-help.out
+}
+
+test_size_help() {
+ equery size --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-size-help.out
+}
+
+test_stats_help() {
+ equery stats --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-stats-help.out
+}
+
+test_uses_help() {
+ equery uses --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-uses-help.out
+}
+
+test_which_help() {
+ equery which --help > ${tmpfile}
+ assert_samefile ${FUNCNAME} ${tmpfile} test-which-help.out
+}
+
+
+# run tests
+
+if [ "`hostname`" != "sky" ] ; then
+ echo "Testing framework is beta and machine dependent; some tests will fail!"
+fi
+
+test_equery_help
+test_belongs_help
+test_check_help
+test_changes_help
+test_depends_help
+test_depgraph_help
+test_files_help
+test_glsa_help
+test_hasuses_help
+test_list_help
+test_size_help
+test_stats_help
+test_uses_help
+test_which_help
+
+rm -f *.tmp \ No newline at end of file
diff --git a/src/equery/tests/test-list-help.out b/src/equery/tests/test-list-help.out
new file mode 100644
index 0000000..82d1fb0
--- /dev/null
+++ b/src/equery/tests/test-list-help.out
@@ -0,0 +1,9 @@
+List all packages matching a query pattern
+Syntax:
+ list <local-opts> pkgspec
+<local-opts> is either of:
+ -i, --installed - search installed packages (default)
+ -I, --exclude-installed - do not search installed packages
+ -p, --portage-tree - also search in portage tree (/usr/portage)
+ -o, --overlay-tree - also search in overlay tree (/usr/local/portage /usr/local/overlays/gentoo-boblycat)
+
diff --git a/src/equery/tests/test-list.sh b/src/equery/tests/test-list.sh
new file mode 100755
index 0000000..a43048b
--- /dev/null
+++ b/src/equery/tests/test-list.sh
@@ -0,0 +1,40 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_list() {
+ equery list > ${tmpfile}
+
+# should test tty output as well
+# pkgs=$(cat ${tmpfile} | wc -l)
+# x=$(grep "[I--]" ${tmpfile} | wc -l)
+# assert_eq ${FUNCNAME} ${pkgs} ${x}
+
+ x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 1
+}
+
+test_list_installed() {
+ test_list
+}
+
+test_list_portage_tree() {
+ equery list -I -p > ${tmpfile}
+}
+
+test_list_overlay_tree() {
+ equery list -I -o > ${tmpfile}
+}
+
+# Run tests
+
+test_list
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-size-help.out b/src/equery/tests/test-size-help.out
new file mode 100644
index 0000000..c0c63a4
--- /dev/null
+++ b/src/equery/tests/test-size-help.out
@@ -0,0 +1,6 @@
+Print size total size of files contained in a given package
+Syntax:
+ size <local-opts> pkgspec
+<local-opts> is either of:
+ -b, --bytes - report size in bytes
+
diff --git a/src/equery/tests/test-size.sh b/src/equery/tests/test-size.sh
new file mode 100755
index 0000000..126a5db
--- /dev/null
+++ b/src/equery/tests/test-size.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_size() {
+ equery size gcc > ${tmpfile}
+
+ x=$(grep "sys-devel/gcc" ${tmpfile} | wc -l)
+
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(egrep "size\([0-9]+\)" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+}
+
+# Run tests
+
+test_size
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-stats-help.out b/src/equery/tests/test-stats-help.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/equery/tests/test-stats-help.out
diff --git a/src/equery/tests/test-uses-help.out b/src/equery/tests/test-uses-help.out
new file mode 100644
index 0000000..d350e00
--- /dev/null
+++ b/src/equery/tests/test-uses-help.out
@@ -0,0 +1,7 @@
+Display USE flags for a given package
+
+Syntax:
+ uses <local-opts> pkgspec
+<local-opts> is either of:
+ -a, --all - include non-installed packages
+
diff --git a/src/equery/tests/test-uses.sh b/src/equery/tests/test-uses.sh
new file mode 100755
index 0000000..d694483
--- /dev/null
+++ b/src/equery/tests/test-uses.sh
@@ -0,0 +1,39 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_uses() {
+ equery uses gcc > ${tmpfile}
+
+ x=$(grep "static" ${tmpfile} | wc -l)
+
+ assert_eq ${FUNCNAME} ${x} 1
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 7
+}
+
+test_uses_all() {
+ equery uses -a uclibc > ${tmpfile}
+
+ x=$(grep "static" ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} ${x} 1
+
+ x=$(cat ${tmpfile} | wc -l)
+ assert_ge ${FUNCNAME} $x 5
+
+}
+
+# Run tests
+
+test_uses
+test_uses_all
+
+rm -f ${tmpfile} \ No newline at end of file
diff --git a/src/equery/tests/test-which-help.out b/src/equery/tests/test-which-help.out
new file mode 100644
index 0000000..8bf337e
--- /dev/null
+++ b/src/equery/tests/test-which-help.out
@@ -0,0 +1,3 @@
+Print full path to ebuild for a given package
+Syntax:
+ size pkgspec
diff --git a/src/equery/tests/test-which.sh b/src/equery/tests/test-which.sh
new file mode 100755
index 0000000..491868f
--- /dev/null
+++ b/src/equery/tests/test-which.sh
@@ -0,0 +1,22 @@
+#! /bin/bash
+#
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright (c) 2004, Gentoo Foundation
+#
+# Licensed under the GNU General Public License, v2
+
+. common-functions.sh
+
+tmpfile=$(tempfilename)
+
+test_which() {
+ file=$(equery which gcc)
+
+ assert_exists ${FUNCNAME} ${file}
+}
+
+# Run tests
+
+test_which
+
+rm -f ${tmpfile} \ No newline at end of file