1use 5.008001; 2use strict; 3use warnings; 4use Test::More 0.96; 5 6use lib 't/lib'; 7use TestUtils qw/exception/; 8 9use Path::Tiny; 10use Cwd; 11 12my $IS_WIN32 = $^O eq 'MSWin32'; 13 14my @cases = ( 15 [ 'foo.txt', [ '.txt', '.png' ], 'foo' ], 16 [ 'foo.png', [ '.txt', '.png' ], 'foo' ], 17 [ 'foo.txt', [ qr/\.txt/, qr/\.png/ ], 'foo' ], 18 [ 'foo.png', [ qr/\.txt/, qr/\.png/ ], 'foo' ], 19 [ 'foo.txt', ['.jpeg'], 'foo.txt' ], 20 [ 'foo/.txt/bar.txt', [ qr/\.txt/, qr/\.png/ ], 'bar' ], 21); 22 23for my $c (@cases) { 24 my ( $input, $args, $result ) = @$c; 25 my $path = path($input); 26 my $base = $path->basename(@$args); 27 is( $base, $result, "$path -> $result" ); 28} 29 30done_testing; 31# 32# This file is part of Path-Tiny 33# 34# This software is Copyright (c) 2014 by David Golden. 35# 36# This is free software, licensed under: 37# 38# The Apache License, Version 2.0, January 2004 39# 40