From 304fc56bca63c7c0ecfbcc571eb1094f36a8eac4 Mon Sep 17 00:00:00 2001 From: karltk Date: Sat, 9 Oct 2004 22:51:18 +0000 Subject: [PATCH] Added unit tests for all commands svn path=/; revision=148 --- trunk/src/equery/ChangeLog | 3 +++ trunk/src/equery/TODO | 6 ++++++ trunk/src/equery/tests/run-all-tests.sh | 12 ++++++++++++ trunk/src/equery/tests/test-depends.sh | 2 +- trunk/src/equery/tests/test-list.sh | 9 +++++---- trunk/src/equery/tests/test-uses.sh | 2 +- 6 files changed, 28 insertions(+), 6 deletions(-) create mode 100755 trunk/src/equery/tests/run-all-tests.sh 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 + * Added unit tests for all supported commands + 2004-09-30 Karl Trygve Kalleberg * 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 +# 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 -- 2.26.2