t / Git-SVN / Utils / canonicalize_url.ton commit Merge branch 'jl/use-vsatisfy-correctly-for-2.0' (5714722)
   1#!/usr/bin/env perl
   2
   3# Test our own home rolled URL canonicalizer.  Test the private one
   4# directly because we can't predict what the SVN API is doing to do.
   5
   6use strict;
   7use warnings;
   8
   9use Test::More 'no_plan';
  10
  11use Git::SVN::Utils;
  12my $canonicalize_url = \&Git::SVN::Utils::_canonicalize_url_ourselves;
  13
  14my %tests = (
  15        "http://x.com"                  => "http://x.com",
  16        "http://x.com/"                 => "http://x.com",
  17        "http://x.com/foo/bar"          => "http://x.com/foo/bar",
  18        "http://x.com//foo//bar//"      => "http://x.com/foo/bar",
  19        "http://x.com/  /%/"            => "http://x.com/%20%20/%25",
  20);
  21
  22for my $arg (keys %tests) {
  23        my $want = $tests{$arg};
  24
  25        is $canonicalize_url->($arg), $want, "canonicalize_url('$arg') => $want";
  26}