This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add test for undefined first argument to fileparse().
authorJames E Keenan <jkeenan@cpan.org>
Wed, 3 Jul 2013 00:03:53 +0000 (02:03 +0200)
committerJames E Keenan <jkeenan@cpan.org>
Thu, 4 Jul 2013 02:35:21 +0000 (04:35 +0200)
lib/File/Basename.t

index 6ff3121..29d7d25 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
     @INC = '../lib';
 }
 
-use Test::More tests => 64;
+use Test::More tests => 65;
 
 BEGIN { use_ok 'File::Basename' }
 
@@ -14,6 +14,12 @@ can_ok( __PACKAGE__, qw( basename fileparse dirname fileparse_set_fstype ) );
 
 ### Testing Unix
 {
+    {
+        eval { fileparse(undef); 1 };
+        like($@, qr/need a valid path/,
+            "detect undef first argument to fileparse()");
+    }
+
     ok length fileparse_set_fstype('unix'), 'set fstype to unix';
     is( fileparse_set_fstype(), 'Unix',     'get fstype' );