Skip to content

Commit

Permalink
Add a set_display test
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed Apr 14, 2015
1 parent 72c9773 commit 5f0fc44
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions t/set_display.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use strict;
use warnings;

use Test::More;

# ABSTRACT: Test the set-display functionality

use Module::Path::Simplify;

my $s = Module::Path::Simplify->new();

my $short = $s->simplify( $INC{'Module/Path/Simplify.pm'} ); # Store name in cache.

cmp_ok( scalar $s->aliases->names, '==', 1, "One entry in cache" );

for my $alias ( $s->aliases->names ) {
$s->aliases->set_display( $alias, "ROBOTS" );
like( $s->aliases->get_path_suffixed( $alias ), qr/ \(\Q$alias\E\)/, "Set display causes suffixes to show up" );
like( $s->aliases->get_display( $alias ), qr/\AROBOTS/, "Set display causes get_display to change" );
}

like( $short = $s->simplify( $INC{'Module/Path/Simplify.pm'} ), qr{\AROBOTS/}, "Simplified path now has custom alias" );
note $short;

note $s->pp_aliases;


done_testing;


0 comments on commit 5f0fc44

Please sign in to comment.