about summary refs log tree commit diff
path: root/third_party/git/t/Git-SVN/Utils/collapse_dotdot.t
blob: 1da1cce156c496d00b4e15690c6fa4613a5ca10e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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";
}