summaryrefslogtreecommitdiff
path: root/t/parent.t
diff options
context:
space:
mode:
authorAdam Spiers <stow@adamspiers.org>2011-11-16 14:04:03 +0000
committerAdam Spiers <stow@adamspiers.org>2011-11-16 14:04:03 +0000
commit0473d3f8ba40ba2a445cbffb2d0b6fa84f774567 (patch)
treea50c7d63ede4d66795f7f5d047da7d41b5f56a67 /t/parent.t
parent0ffef1809a8a0b1c82ed4fd339ac32624c2a3c4e (diff)
downloadstow-0473d3f8ba40ba2a445cbffb2d0b6fa84f774567.tar.gz
Grafted root commit from savannah git master:v2.0.2
38dcdcb08c60f4cc661395beb22641c46add9e6c Initial Import
Diffstat (limited to 't/parent.t')
-rw-r--r--t/parent.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/parent.t b/t/parent.t
new file mode 100644
index 0000000..52a4bea
--- /dev/null
+++ b/t/parent.t
@@ -0,0 +1,41 @@
+#!/usr/local/bin/perl
+
+#
+# Testing parent()
+#
+
+# load as a library
+BEGIN { use lib qw(. ..); require "stow"; }
+
+use Test::More tests => 5;
+
+is(
+ parent('a/b/c'),
+ 'a/b',
+ => 'no leading or trailing /'
+);
+
+is(
+ parent('/a/b/c'),
+ '/a/b',
+ => 'leading /'
+);
+
+is(
+ parent('a/b/c/'),
+ 'a/b',
+ => 'trailing /'
+);
+
+is(
+ parent('/////a///b///c///'),
+ '/a/b',
+ => 'multiple /'
+);
+
+is (
+ parent('a'),
+ ''
+ => 'empty parent'
+);
+