about summary refs log tree commit diff
path: root/third_party/git/t/Git-SVN/Utils/collapse_dotdot.t
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/t/Git-SVN/Utils/collapse_dotdot.t')
-rwxr-xr-xthird_party/git/t/Git-SVN/Utils/collapse_dotdot.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/third_party/git/t/Git-SVN/Utils/collapse_dotdot.t b/third_party/git/t/Git-SVN/Utils/collapse_dotdot.t
new file mode 100755
index 000000000000..1da1cce156c4
--- /dev/null
+++ b/third_party/git/t/Git-SVN/Utils/collapse_dotdot.t
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+use Git::SVN::Utils;
+my $collapse_dotdot = \&Git::SVN::Utils::_collapse_dotdot;
+
+my %tests = (
+	"foo/bar/baz"			=> "foo/bar/baz",
+	".."				=> "..",
+	"foo/.."			=> "",
+	"/foo/bar/../../baz"		=> "/baz",
+	"deeply/.././deeply/nested"	=> "./deeply/nested",
+);
+
+for my $arg (keys %tests) {
+	my $want = $tests{$arg};
+
+	is $collapse_dotdot->($arg), $want, "_collapse_dotdot('$arg') => $want";
+}