set locale "C" in tests

This ensures that the error string is what we expect it to be
This commit is contained in:
Graham Ollis
2012-12-26 21:22:07 -05:00
parent 5116c191f3
commit 6146b1f2f5
2 changed files with 14 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
Revision history for Mojolicious::Plugin::TtRenderer
{{$NEXT}}
- Set locale "C" in tests that rely on it
1.30 December 22, 2012
- Don't rely on English locale in the test t/tt_plugin_lite_app.t

View File

@@ -5,6 +5,18 @@
use strict;
use warnings;
BEGIN {
#use if $^O ne 'MSWin32', POSIX => qw/setlocale LC_ALL/;
#setlocale(&LC_ALL, 'C') if $^O ne 'MSWin32';
unless($^O eq 'MSWin32') {
eval q{
use POSIX qw( setlocale LC_ALL );
setlocale(LC_ALL, 'C');
};
warn $@ if $@;
}
}
use File::Temp;
use Mojo::IOLoop;
use Test::More;
@@ -41,7 +53,7 @@ my $t = Test::Mojo->new;
# Simple TT template
$t->get_ok('/')->status_is(200)
->content_like(qr/test123456/);
$t->get_ok('/blow')->status_is(500)->content_like(qr/file error - doesnotexist.tt:/);
$t->get_ok('/blow')->status_is(500)->content_like(qr/file error - doesnotexist\.tt: No such file or directory/);
if(eval q{ use Devel::Cycle; 1 })
{