Forward port diagnostics and $/ bug fix from 7.4 and Commerce branches.

This commit is contained in:
Colin Kuskie 2008-02-18 18:30:29 +00:00
parent 4b82481594
commit ed017f6007
2 changed files with 6 additions and 4 deletions

View file

@ -619,7 +619,7 @@ sub getFileContentsAsScalar {
my $filename = shift;
my $content;
open (my $FILE,"<",$self->getPath($filename));
local undef $/;
local $/;
$content = <$FILE>;
close($FILE);
return $content;

View file

@ -26,7 +26,7 @@ my $session = WebGUI::Test->session;
my ($extensionTests, $fileIconTests) = setupDataDrivenTests($session);
my $numTests = 81; # increment this value for each test you create
my $numTests = 82; # increment this value for each test you create
plan tests => $numTests + scalar @{ $extensionTests } + scalar @{ $fileIconTests };
my $uploadDir = $session->config->get('uploadsPath');
@ -65,7 +65,7 @@ is( $storage1->getLastError, undef, "No errors during path creation");
#
####################################################
is( $storage1->getPathFrag, 'fo/ob/foobar');
is( $storage1->getPathFrag, 'fo/ob/foobar', 'pathFrag returns correct value');
####################################################
#
@ -171,7 +171,7 @@ open my $fcon, "< ".$filePath or
die "Unable to open $filePath for reading: $!\n";
my $fileContents;
{
local undef $/;
local $/;
$fileContents = <$fcon>;
}
close $fcon;
@ -180,6 +180,8 @@ is ($fileContents, $content, 'file contents match');
is ($storage1->getFileContentsAsScalar($filename), $content, 'getFileContentsAsScalar matches');
isnt($/, undef, 'getFileContentsAsScalar did not change $/');
foreach my $extTest (@{ $extensionTests }) {
is( $storage1->getFileExtension($extTest->{filename}), $extTest->{extension}, $extTest->{comment} );
}