diff --git a/Changes b/Changes index 7c71df4..aeb15d6 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,11 @@ Revision history for Mojolicious::Plugin::TtRenderer {{$NEXT}} + - silenced a few annoying warnings during test + - use temp directory for COMPILE_DIR in tests to avoid failures if the + default compile directory already exists and is owned by someone else. + +1.31 December 26, 2012 - Set locale "C" in tests that rely on it 1.30 December 22, 2012 diff --git a/t/00-load.t b/t/00-load.t index bd18b0a..99bdb96 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -7,4 +7,3 @@ BEGIN { use_ok( 'Mojolicious::Plugin::TtRenderer::Engine' ); } -diag( "Testing Mojolicious::Plugin::TtRenderer::Engine $Mojolicious::Plugin::TtRenderer::Engine::VERSION, Perl $], $^X" ); diff --git a/t/deep_recursion.t b/t/deep_recursion.t index 27f30bf..32a392d 100644 --- a/t/deep_recursion.t +++ b/t/deep_recursion.t @@ -11,11 +11,14 @@ use Test::More tests => 3; use Mojolicious::Lite; use Test::Mojo; +use File::Temp qw( tempdir tempfile ); +my($fh_log,$filename_log) = tempfile('fooXXXXX', TMPDIR => 1, UNLINK => 1); # Silence app->log->level('fatal'); +app->log->path($filename_log); -plugin 'tt_renderer'; +plugin 'tt_renderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }}; get '/exception' => sub { die }; diff --git a/t/default_template.t b/t/default_template.t index 7f5ca9b..f61b584 100644 --- a/t/default_template.t +++ b/t/default_template.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More tests => 3; use Test::Mojo; +use File::Temp qw( tempdir ); use Mojolicious::Lite; @@ -11,7 +12,7 @@ app->plugin( template_options => { # These options are specific to TT INCLUDE_PATH => 'templates', - COMPILE_DIR => 'templates_c', + COMPILE_DIR => tempdir( CLEANUP => 1 ), COMPILE_EXT => '.ttc', # ... anything else to be passed on to TT should go here }, diff --git a/t/lite_app.t b/t/lite_app.t index 800aa47..0ca0c7e 100644 --- a/t/lite_app.t +++ b/t/lite_app.t @@ -12,13 +12,14 @@ use Test::More tests => 39; use Mojolicious::Lite; use Mojo::ByteStream 'b'; use Test::Mojo; +use File::Temp qw( tempdir ); # Silence app->log->level('fatal'); use_ok('Mojolicious::Plugin::TtRenderer::Engine'); -plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1}}; +plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1, COMPILE_DIR => tempdir( CLEANUP => 1 ) }}; get '/exception' => 'error'; diff --git a/t/multiple_paths.t b/t/multiple_paths.t index a245cd2..746ae5e 100644 --- a/t/multiple_paths.t +++ b/t/multiple_paths.t @@ -11,6 +11,7 @@ use Test::More tests => 6; use Mojolicious::Lite; use Test::Mojo; +use File::Temp qw( tempdir ); # Silence app->log->level('fatal'); @@ -18,7 +19,7 @@ app->log->level('fatal'); my @paths = map { app->home->rel_dir($_) } "templates/multiple_first", "templates/multiple_second"; app->renderer->paths([@paths]); -plugin 'TtRenderer'; +plugin 'TtRenderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }}; get '/first' => 'first'; get '/second' => 'second'; diff --git a/t/tt_plugin_lite_app.t b/t/tt_plugin_lite_app.t index 6735752..298253f 100644 --- a/t/tt_plugin_lite_app.t +++ b/t/tt_plugin_lite_app.t @@ -17,12 +17,12 @@ BEGIN { } } -use File::Temp; +use File::Temp qw( tempdir ); use Mojo::IOLoop; use Test::More; # Use a clean temporary directory -BEGIN { $ENV{MOJO_TMPDIR} ||= File::Temp::tempdir } +BEGIN { $ENV{MOJO_TMPDIR} ||= tempdir( CLEANUP => 1) } # Make sure sockets are working plan skip_all => 'working sockets required for this test!' @@ -36,7 +36,7 @@ use Mojolicious::Lite; use Test::Mojo; # POD renderer plugin -plugin 'tt_renderer'; +plugin 'tt_renderer' => {template_options => { COMPILE_DIR => tempdir( CLEANUP => 1 ) }}; # Silence app->log->level('error'); @@ -57,6 +57,8 @@ $t->get_ok('/blow')->status_is(500)->content_like(qr/file error - doesnotexist\. if(eval q{ use Devel::Cycle; 1 }) { + # ignore warnings coming from Devel::Cycle + local $SIG{__WARN__} = sub { }; Devel::Cycle::find_cycle(app, sub { my $arg = shift; # Template::Provider (from which M::P::T::Provider inherits) has some cycles which are freed manaully by diff --git a/t/two_data.t b/t/two_data.t index 9113272..938be9a 100644 --- a/t/two_data.t +++ b/t/two_data.t @@ -20,7 +20,7 @@ use_ok 'Foo'; push @{app->renderer->classes}, 'Foo'; -plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1}}; +plugin 'tt_renderer' => {template_options => {PRE_CHOMP => 1, POST_CHOMP => 1, TRIM => 1, COMPILE_DIR => tempdir( CLEANUP => 1 )}}; app->log->level('fatal');