Subject: | Spoon-23/Win32/Perl 5.6.1 - test fixes enclosed |
Encompassing other fixes I've added to other RT tickets for this module,
I now have a working 'nmake test'. It might not be exactly what is
required, but at least all tests pass, with those requiring Encode (it's
5.8 only) skipping.
Attached patch fixes all previously failing tests, and adds the DB_File
prequisite to MAkefile.PL.
Subject: | spoon23-win32-perl561-testfixes.patch |
--- Spoon-0.23/Makefile.PL Thu Apr 7 04:37:14 2005
+++ Spoon-0.23-barbie/Makefile.PL Mon Feb 6 16:43:42 2006
@@ -11,6 +11,7 @@
Spiffy 0.22
IO::All 0.32
Template 2.10
+ DB_File 0
));
clean_files('t/tmp', 't/output');
--- Spoon-0.23/t/cgi.t Thu Apr 7 04:37:14 2005
+++ Spoon-0.23-barbie/t/cgi.t Mon Feb 6 16:38:11 2006
@@ -3,7 +3,9 @@
use warnings;
use Test::More;
-use Encode;
+eval "use Encode";
+my $enc = ! $@;
+
use Spoon::CGI;
use URI::Escape;
@@ -25,7 +27,10 @@
$ENV{QUERY_STRING} = "param1=2;foo=bar";
my $test1 = Test1->new;
- ok( Encode::is_utf8($test1->param1), 'param1 is marked as utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8($test1->param1), 'param1 is marked as utf8' );
+ }
is( $test1->param1, 2, 'param1 value is 2' );
}
@@ -35,7 +40,10 @@
$ENV{QUERY_STRING} = 'param1=%E1%9A%A0%E1%9B%87%E1%9A%BB;foo=bar';
my $test1 = Test1->new;
- ok( Encode::is_utf8($test1->param1), 'param1 is marked as utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8($test1->param1), 'param1 is marked as utf8' );
+ }
is( $test1->param1, "\x{16A0}\x{16C7}\x{16BB}",
'param1 value is \x{16A0}\x{16C7}\x{16BB}' );
}
@@ -46,7 +54,10 @@
$ENV{QUERY_STRING} = 'param2=%E1%9A%A0%E1%9B%87%E1%9A%BB;foo=bar';
my $test1 = Test1->new;
- ok( Encode::is_utf8($test1->param2), 'param2 is marked as utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8($test1->param2), 'param2 is marked as utf8' );
+ }
is( $test1->param2, "\x{16A0}\x{16C7}\x{16BB}",
'param2 value is \x{16A0}\x{16C7}\x{16BB}' );
}
@@ -57,7 +68,10 @@
$ENV{QUERY_STRING} = 'trimmed=%20%20trim%20me%20%20;foo=bar';
my $test1 = Test1->new;
- ok( Encode::is_utf8($test1->trimmed), 'trimmed is marked as utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8($test1->trimmed), 'trimmed is marked as utf8' );
+ }
is( $test1->trimmed, "trim me",
'trimmed value is "trim me"' );
}
@@ -68,7 +82,10 @@
$ENV{QUERY_STRING} = 'nl=line1%0d%0aline2%0dline3;foo=bar';
my $test1 = Test1->new;
- ok( Encode::is_utf8($test1->nl), 'nl is marked as utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8($test1->nl), 'nl is marked as utf8' );
+ }
is( $test1->nl, "line1\nline2\nline3\n",
'nl only contains unix newlines' );
}
--- Spoon-0.23/t/compile.t Thu Apr 7 04:37:14 2005
+++ Spoon-0.23-barbie/t/compile.t Mon Feb 6 15:19:37 2006
@@ -6,8 +6,8 @@
for (grep {! /CVS/ && ! /(?:~|\.swp)$/ && ! /.svn/} io('lib')->All_Files) {
my $name = $_->name;
- $name =~ s/^lib\/(.*)\.pm$/$1/;
- $name =~ s/\//::/g;
+ $name =~ s/^lib\W(.*)\.pm$/$1/;
+ $name =~ s/\W/::/g;
eval "require $name; 1";
is($@, '', "Compile $name");
}
--- Spoon-0.23/t/utf8-content.t Thu Apr 7 04:37:14 2005
+++ Spoon-0.23-barbie/t/utf8-content.t Mon Feb 6 16:38:11 2006
@@ -3,7 +3,9 @@
use warnings;
use Test::More;
-use Encode;
+eval "use Encode";
+my $enc = ! $@;
+
use Spoon::ContentObject;
plan tests => 8;
@@ -27,7 +29,10 @@
my $object = Spoon::ContentObject->new(id => 'test1');
$object->load_content;
- ok( Encode::is_utf8( $object->content ), 'object content is utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8( $object->content ), 'object content is utf8' );
+ }
is( $object->content, "This file has no utf8 in it.\n",
'test content was loaded' );
@@ -39,7 +44,10 @@
$object->load_content;
- ok( Encode::is_utf8( $object->content ), 'object content is utf8 after save/load' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8( $object->content ), 'object content is utf8 after save/load' );
+ }
is( $object->content, "This file has no utf8 in it.\n",
'test content was loaded after save/load' );
}
@@ -50,7 +58,10 @@
my $object = Spoon::ContentObject->new(id => 'test2');
$object->load_content;
- ok( Encode::is_utf8( $object->content ), 'object content is utf8' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8( $object->content ), 'object content is utf8' );
+ }
is( $object->content, "This file has utf8 in it - \x{16A0}\x{16C7}\x{16BB}.\n",
'test content was loaded' );
@@ -62,7 +73,10 @@
$object->load_content;
- ok( Encode::is_utf8( $object->content ), 'object content is utf8 after save/load' );
+ SKIP: {
+ skip "Encode not installed", 1 unless($enc);
+ ok( Encode::is_utf8( $object->content ), 'object content is utf8 after save/load' );
+ }
is( $object->content, "This file has utf8 in it - \x{16A0}\x{16C7}\x{16BB}.\n",
'test content was loaded after save/load' );
}
--- Spoon-0.23/t/utf8.t Thu Apr 7 04:37:14 2005
+++ Spoon-0.23-barbie/t/utf8.t Mon Feb 6 16:42:08 2006
@@ -3,7 +3,11 @@
use warnings;
use Test::More;
-use Encode;
+eval "use Encode";
+if($@) {
+ plan skip_all => "Encode not installed.";
+}
+
use Spoon::Base;
plan tests => 5;