On Sun, Nov 16, 2003 at 05:15:35AM -0800, Max Horn wrote: > --- get_perl.t 15 Nov 2003 11:57:59 -0000 1.3 > +++ get_perl.t 16 Nov 2003 13:15:33 -0000 1.4 > @@ -16,7 +16,13 @@ > isa_ok( $pv, 'Fink::PkgVersion' ); > > my($perldir, $perlarch) = $pv->get_perl_dir_arch; > -#like( $perldir, qr{^/ 5 \. \d{1,2} \. \d{1,2} $}x ); > + > +# The following test is somewhat questionable, since it imposes a rather > +# strict limitation on a directory name which potentially can be of > +# arbitrary form. As such it may have to be adapted when/if get_perl_dir_arch() > +# is changed in the future. > +like( $perldir, qr{^(/ 5 \. \d{1,2} \. \d{1,2} )?$}x );
Come now, that's just silly. That regex will handle every version of Perl from 5.6 to 5.99.99. Are you really worried about 6.0 or 5.100? The $perlarch test is equally questionable in that it assumes we'll always be running on darwin. What if fink ports to Windows?! Oh no! ;) Furthermore, comments of the form "this test will have to be adapted when the behavior of this function changes" are a waste of time. That's a given. At some point you have to draw a line in order to be able to test things with somewhat variable output at all. Otherwise you'll drive yourself nuts trying to handle all the possible future beahviors. Its pretty safe to say that get_perl_dir_arch() returns the version directory as /x.y.z and that x is going to be 5, and y and z are going to be numbers from 0 to 100. If the behavior is deliberately changed, you adjust the test. Tests just tell you that things don't work the same as before. Finally, that's *not* why the test is questionable. Its because it assumed there's *always* going to be a version directory returned. That's the way the code was written before. Now the behavior has changed. Change the test to match. Its really very simple. I'll do this one. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern/ <mendel> ScHWeRnsChweRN sChWErN SchweRN SCHWErNSChwERnsCHwERN sChWErn ScHWeRn schweRn sCHWErN schWeRn scHWeRN SchWeRN scHWErn SchwErn scHWErn ScHweRN sChwern scHWerN scHWeRn scHWerN ScHwerN SChWeRN scHWeRn SchwERNschwERn SCHwern sCHWErN SCHWErN sChWeRn ------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl _______________________________________________ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel