summaryrefslogtreecommitdiff
path: root/test/libapt/fileutl_test.cc
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2012-10-17 10:27:50 +0200
committerMichael Vogt <mvo@debian.org>2013-08-15 09:43:43 +0200
commit488011fa99aee25bedb39ae2cc3115ad1ab000c0 (patch)
treec99ac9dd28d4e50df79a47f7920829c9cb39c179 /test/libapt/fileutl_test.cc
parentd8a06f6e478323b2fa8573f6f885c0b16d403642 (diff)
* lp:~mvo/apt/add-glob-function:
- add Glob() to fileutl.{cc,h} Conflicts: apt-pkg/contrib/fileutl.h debian/changelog
Diffstat (limited to 'test/libapt/fileutl_test.cc')
-rw-r--r--test/libapt/fileutl_test.cc42
1 files changed, 42 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;
+}