diff options
Diffstat (limited to 'test/libapt')
-rw-r--r-- | test/libapt/fileutl_test.cc | 42 | ||||
-rw-r--r-- | test/libapt/makefile | 5 |
2 files changed, 47 insertions, 0 deletions
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc new file mode 100644 index 000000000..b6b8ac579 --- /dev/null +++ b/test/libapt/fileutl_test.cc @@ -0,0 +1,42 @@ +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> + +#include "assert.h" +#include <string> +#include <vector> + +#include <stdio.h> +#include <iostream> +#include <stdlib.h> + + +int main(int argc,char *argv[]) +{ + std::vector<std::string> files; + + // normal match + files = Glob("*.lst"); + if (files.size() != 1) + { + _error->DumpErrors(); + return 1; + } + + // not there + files = Glob("xxxyyyzzz"); + if (files.size() != 0 || _error->PendingError()) + { + _error->DumpErrors(); + return 1; + } + + // many matches (number is a bit random) + files = Glob("*.cc"); + if (files.size() < 10) + { + _error->DumpErrors(); + return 1; + } + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 1b67cba9d..73403b24c 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -98,6 +98,11 @@ include $(PROGRAM_H) PROGRAM = IndexCopyToSourceList${BASENAME} SLIBS = -lapt-pkg SOURCE = indexcopytosourcelist_test.cc + +# test fileutls +PROGRAM = FileUtl${BASENAME} +SLIBS = -lapt-pkg +SOURCE = fileutl_test.cc include $(PROGRAM_H) # test tagfile |