The branch, master has been updated
via 9da6daf8e79850c56505a39bd1473989dacc900c (commit)
from 100cf7102507c94bc5014e2033b5ace748700c41 (commit)
- Shortlog ------------------------------------------------------------
9da6daf Add non-regression tests for Dpkg::Path
Summary of changes:
ChangeLog | 6 ++++++
scripts/Makefile.am | 3 ++-
scripts/t/500_Dpkg_Path.t | 45 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 1 deletions(-)
-----------------------------------------------------------------------
Details of changes:
commit 9da6daf8e79850c56505a39bd1473989dacc900c
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Thu Dec 13 19:22:38 2007 +0100
Add non-regression tests for Dpkg::Path
diff --git a/ChangeLog b/ChangeLog
index a012430..e37452a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-13 Raphael Hertzog <[EMAIL PROTECTED]>
+
+ * scripts/t/500_Dpkg_Path.t, scripts/Makefile.am: Add new
+ non-regression tests for functions provided by the Dpkg::Path
+ module.
+
2007-12-12 Guillem Jover <[EMAIL PROTECTED]>
* scripts/dpkg-genchanges.pl: Fix typo (syserror() -> syserr()).
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 4a7ca23..f52457e 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -68,7 +68,8 @@ EXTRA_DIST = \
t/200_Dpkg_Shlibs/objdump.dbd-pg \
t/200_Dpkg_Shlibs/objdump.ls \
t/300_Dpkg_BuildOptions.t \
- t/400_Dpkg_Deps.t
+ t/400_Dpkg_Deps.t \
+ t/500_Dpkg_Path.t
CLEANFILES = \
$(bin_SCRIPTS) $(sbin_SCRIPTS) $(changelog_SCRIPTS) \
diff --git a/scripts/t/500_Dpkg_Path.t b/scripts/t/500_Dpkg_Path.t
new file mode 100644
index 0000000..0d20edd
--- /dev/null
+++ b/scripts/t/500_Dpkg_Path.t
@@ -0,0 +1,45 @@
+# -*- mode: cperl;-*-
+
+use Test::More tests => 16;
+
+use strict;
+use warnings;
+
+use_ok('Dpkg::Path', 'canonpath', 'resolve_symlink',
+ 'check_files_are_the_same', 'get_pkg_root_dir',
+ 'guess_pkg_root_dir', 'relative_to_pkg_root');
+
+mkdir "t.tmp/a";
+mkdir "t.tmp/a/b";
+mkdir "t.tmp/a/b/c";
+mkdir "t.tmp/a/DEBIAN";
+mkdir "t.tmp/debian";
+mkdir "t.tmp/debian/a";
+mkdir "t.tmp/debian/a/b";
+mkdir "t.tmp/debian/a/b/c";
+symlink "a/b/c", "t.tmp/cbis";
+symlink "/this/does/not/exist", "t.tmp/tmp";
+symlink ".", "t.tmp/here";
+
+is(canonpath("t.tmp/./a///b/c"), "t.tmp/a/b/c", "canonpath basic test");
+is(canonpath("t.tmp/a/b/../../a/b/c"), "t.tmp/a/b/c", "canonpath and ..");
+is(canonpath("t.tmp/a/b/c/../../"), "t.tmp/a", "canonpath .. at end");
+is(canonpath("t.tmp/cbis/../"), "t.tmp/cbis/..", "canonpath .. after symlink");
+
+is(resolve_symlink("t.tmp/here/cbis"), "t.tmp/here/a/b/c", "resolve_symlink");
+is(resolve_symlink("t.tmp/tmp"), "/this/does/not/exist", "resolve_symlink
absolute");
+is(resolve_symlink("t.tmp/here"), "t.tmp", "resolve_symlink .");
+
+ok(!check_files_are_the_same("t.tmp/here", "t.tmp"), "Symlink is not the
same!");
+ok(check_files_are_the_same("t.tmp/here/a", "t.tmp/a"), "Same directory");
+
+is(get_pkg_root_dir("t.tmp/a/b/c"), "t.tmp/a", "get_pkg_root_dir");
+is(guess_pkg_root_dir("t.tmp/a/b/c"), "t.tmp/a", "guess_pkg_root_dir");
+is(relative_to_pkg_root("t.tmp/a/b/c"), "b/c", "relative_to_pkg_root");
+
+chdir("t.tmp");
+
+ok(!defined(get_pkg_root_dir("debian/a/b/c")), "get_pkg_root_dir undef");
+ok(!defined(relative_to_pkg_root("debian/a/b/c")), "relative_to_pkg_root");
+is(guess_pkg_root_dir("debian/a/b/c"), "debian/a", "guess_pkg_root_dir
fallback");
+
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]