From 8d01b9d692f49309235e710b79937baf605fda3d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 4 Sep 2012 12:21:29 +0200 Subject: add "Glob()" to fileutl --- test/libapt/fileutl_test.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ test/libapt/makefile | 6 ++++++ 2 files changed, 48 insertions(+) create mode 100644 test/libapt/fileutl_test.cc (limited to 'test/libapt') 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 +#include + +#include "assert.h" +#include +#include + +#include +#include +#include + + +int main(int argc,char *argv[]) +{ + std::vector 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 1952051e2..1e3652e00 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -80,3 +80,9 @@ PROGRAM = CdromFindPackages${BASENAME} SLIBS = -lapt-pkg SOURCE = cdromfindpackages_test.cc include $(PROGRAM_H) + +# test fileutls +PROGRAM = FileUtl${BASENAME} +SLIBS = -lapt-pkg +SOURCE = fileutl_test.cc +include $(PROGRAM_H) -- cgit v1.2.3