Skip Menu |

This queue is for tickets about the Test-Dir CPAN distribution.

Report information
The Basics
Id: 65790
Status: resolved
Worked: 45 min
Priority: 0/
Queue: Test-Dir

People
Owner: MTHURN [...] cpan.org
Requestors: MRDVT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.006
Fixed in: (no value)



Subject: Test::Dir addtions like Test::File
In order to "align" Test::Dir with Test::File conventions I suggest the following additions. dir_empty_ok (I guess readdir(less "." and "..") = 0 but not sure how portable) dir_readable_ok (both -d and -r) dir_writable_ok (both -d and -w) dir_executable_ok (both -d and -x) dir_not_empty_ok (I guess readdir(less "." and "..") > 0 but not sure how portable) dir_not_readable_ok (both -d and !-r) dir_not_writable_ok (both -d and !-w) dir_not_executable_ok (both -d and !-x) I personally would super class Test::Dir and Test::Folder as the code is identical between the two. e.g. package Test::Dir::Base; dir_subs... *folder_subX=\&dir_subX; export nothing package Test::Dir; use base qw{Test::Dir::Base}; export :dir group package Test::Folder; use base qw{Test::Dir::Base}; export :folder group From: http://arstechnica.com/civis/viewtopic.php?f=20&t=290481 sub dir_is_empty { my ($path) = @_; opendir DIR, $path; while(my $entry = readdir DIR) { next if($entry =~ /^\.\.?$/); closedir DIR; return 0; } closedir DIR; return 1; }
Thanks for the suggestions. Just uploaded to CPAN.