Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/Git-SVN/Utils/join_paths.t # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / Git-SVN / Utils / join_paths.t` 32 lines ยท 737 bytes Raw Blame History 1 #!/usr/bin/env perl 2 3 use strict; 4 use warnings; 5 6 use Test::More 'no_plan'; 7 8 use Git::SVN::Utils qw( 9 join_paths 10 ); 11 12 # A reference cannot be a hash key, so we use an array. 13 my @tests = ( 14 [] => '', 15 ["/x.com", "bar"] => '/x.com/bar', 16 ["x.com", ""] => 'x.com', 17 ["/x.com/foo/", undef, "bar"] => '/x.com/foo/bar', 18 ["x.com/foo/", "/bar/baz/"] => 'x.com/foo/bar/baz/', 19 ["foo", "bar"] => 'foo/bar', 20 ["/foo/bar", "baz", "/biff"] => '/foo/bar/baz/biff', 21 ["", undef, "."] => '.', 22 [] => '', 23 24 ); 25 26 while(@tests) { 27 my($have, $want) = splice @tests, 0, 2; 28 29 my $args = join ", ", map { qq['$_'] } map { defined($_) ? $_ : 'undef' } @$have; 30 my $name = "join_paths($args) eq '$want'"; 31 is join_paths(@$have), $want, $name; 32 }