Navigation Menu

Skip to content

Commit

Permalink
better asset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 16, 2012
1 parent 51a0787 commit 050a25c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/Mojo/Log.pm
Expand Up @@ -96,10 +96,10 @@ Mojo::Log - Simple logger
my $log = Mojo::Log->new(path => '/var/log/mojo.log', level => 'warn');
# Log messages
$log->debug('Why isn't this working?');
$log->info('FYI: it happened again');
$log->warn('This might be a problem');
$log->error('Garden variety error');
$log->debug('Why is this not working?');
$log->info('FYI: it happened again.');
$log->warn('This might be a problem.');
$log->error('Garden variety error.');
$log->fatal('Boom!');
=head1 DESCRIPTION
Expand Down
12 changes: 4 additions & 8 deletions t/mojo/asset.t
Expand Up @@ -104,16 +104,13 @@ is $mem->contains('db'), -1, 'does not contain "db"';
}

# Move memory asset to file
$mem = Mojo::Asset::Memory->new;
$mem->add_chunk('abc');
my $tmp = Mojo::Asset::File->new;
$tmp->add_chunk('x');
$mem = Mojo::Asset::Memory->new->add_chunk('abc');
my $tmp = Mojo::Asset::File->new->add_chunk('x');
$path = $tmp->path;
ok -e $path, 'file exists';
undef $tmp;
ok !-e $path, 'file has been cleaned up';
$mem->move_to($path);
is $mem->slurp, 'abc', 'right content';
is $mem->move_to($path)->slurp, 'abc', 'right content';
ok -e $path, 'file exists';
unlink $path;
ok !-e $path, 'file has been cleaned up';
Expand All @@ -127,8 +124,7 @@ $path = $tmp->path;
ok -e $path, 'file exists';
undef $tmp;
ok !-e $path, 'file has been cleaned up';
$file->move_to($path);
is $file->slurp, 'bcd', 'right content';
is $file->move_to($path)->slurp, 'bcd', 'right content';
undef $file;
ok -e $path, 'file exists';
unlink $path;
Expand Down

0 comments on commit 050a25c

Please sign in to comment.