aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkarltk <karltk@gentoo.org>2004-10-09 22:51:18 +0000
committerkarltk <karltk@gentoo.org>2004-10-09 22:51:18 +0000
commit304fc56bca63c7c0ecfbcc571eb1094f36a8eac4 (patch)
treef2031dd6e3ed0258a1ccf986374d439ecbe404b1
parentMore tests (diff)
downloadgentoolkit-304fc56bca63c7c0ecfbcc571eb1094f36a8eac4.tar.gz
gentoolkit-304fc56bca63c7c0ecfbcc571eb1094f36a8eac4.tar.bz2
gentoolkit-304fc56bca63c7c0ecfbcc571eb1094f36a8eac4.zip
Added unit tests for all commands
svn path=/; revision=148
-rw-r--r--trunk/src/equery/ChangeLog3
-rw-r--r--trunk/src/equery/TODO6
-rwxr-xr-xtrunk/src/equery/tests/run-all-tests.sh12
-rwxr-xr-xtrunk/src/equery/tests/test-depends.sh2
-rwxr-xr-xtrunk/src/equery/tests/test-list.sh9
-rwxr-xr-xtrunk/src/equery/tests/test-uses.sh2
6 files changed, 28 insertions, 6 deletions
diff --git a/trunk/src/equery/ChangeLog b/trunk/src/equery/ChangeLog
index b05e923..8531a70 100644
--- a/trunk/src/equery/ChangeLog
+++ b/trunk/src/equery/ChangeLog
@@ -1,3 +1,6 @@
+2004-10-10 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added unit tests for all supported commands
+
2004-09-30 Karl Trygve Kalleberg <karltk@gentoo.org>
* Added unit tests for --help
* Added unit tests for 'files'
diff --git a/trunk/src/equery/TODO b/trunk/src/equery/TODO
index 7db2b39..5f38e60 100644
--- a/trunk/src/equery/TODO
+++ b/trunk/src/equery/TODO
@@ -1,3 +1,9 @@
+- sqlite
+ - regexp comparisons
+ - check /var/log/emerge.log for database up-to-dateness
+
+
+-------------------------
- pkgquery language:
Query ::= NewStyle | OldStyle | with OldStyle NewStyle
NewStyle ::= NameVar in /RegExp/
diff --git a/trunk/src/equery/tests/run-all-tests.sh b/trunk/src/equery/tests/run-all-tests.sh
new file mode 100755
index 0000000..4fe2dfe
--- /dev/null
+++ b/trunk/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/trunk/src/equery/tests/test-depends.sh b/trunk/src/equery/tests/test-depends.sh
index a70dcfc..e46d614 100755
--- a/trunk/src/equery/tests/test-depends.sh
+++ b/trunk/src/equery/tests/test-depends.sh
@@ -13,7 +13,7 @@ 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)
diff --git a/trunk/src/equery/tests/test-list.sh b/trunk/src/equery/tests/test-list.sh
index fae5426..a43048b 100755
--- a/trunk/src/equery/tests/test-list.sh
+++ b/trunk/src/equery/tests/test-list.sh
@@ -12,11 +12,12 @@ tmpfile=$(tempfilename)
test_list() {
equery list > ${tmpfile}
- pkgs=$(cat ${tmpfile} | wc -l)
- x=$(grep "[I--]" ${tmpfile} | wc -l)
- assert_eq ${FUNCNAME} ${pkgs} ${x]
+# 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" | wc -l)
+ x=$(grep "app-shells/bash" ${tmpfile} | wc -l)
assert_ge ${FUNCNAME} $x 1
}
diff --git a/trunk/src/equery/tests/test-uses.sh b/trunk/src/equery/tests/test-uses.sh
index f03e786..d694483 100755
--- a/trunk/src/equery/tests/test-uses.sh
+++ b/trunk/src/equery/tests/test-uses.sh
@@ -24,7 +24,7 @@ test_uses_all() {
equery uses -a uclibc > ${tmpfile}
x=$(grep "static" ${tmpfile} | wc -l)
- assert_eq ${FUNCNAME} ${pkgs} ${x]
+ assert_ge ${FUNCNAME} ${x} 1
x=$(cat ${tmpfile} | wc -l)
assert_ge ${FUNCNAME} $x 5