1 # $Id: enc_module.t,v 1.2 2003/03/09 17:32:43 dankogai Exp $
2 # This file is in euc-jp
4 require Config; import Config;
5 if ($Config{'extensions'} !~ /\bEncode\b/) {
6 print "1..0 # Skip: Encode was not built\n";
9 unless (find PerlIO::Layer 'perlio') {
10 print "1..0 # Skip: PerlIO was not built\n";
13 if (defined ${^UNICODE} and ${^UNICODE} != 0){
14 print "1..0 # Skip: \${^UNICODE} == ${^UNICODE}\n";
17 if (ord("A") == 193) {
18 print "1..0 # encoding pragma does not support EBCDIC platforms\n";
23 use lib qw(ext/Encode/t ../ext/Encode/t); # in case of perl core
25 use encoding "euc-jp";
26 use Test::More tests => 3;
29 use File::Compare qw(compare_text);
31 my $dir = dirname(__FILE__);
32 my $file0 = File::Spec->catfile($dir,"enc_module.enc");
33 my $file1 = File::Spec->catfile($dir,"$$.enc");
35 my $obj = Mod_EUCJP->new;
36 local $SIG{__WARN__} = sub{}; # to silence reopening STD(IN|OUT) w/o closing
38 open STDOUT, ">", $file1 or die "$file1:$!";
39 print $obj->str, "\n";
40 $obj->set("¥Æ¥¹¥Èʸ»úÎó");
41 print $obj->str, "\n";
44 my $cmp = compare_text($file0, $file1);
45 is($cmp, 0, "encoding vs. STDOUT");
46 unlink $file1 unless $cmp;
48 my @cmp = qw/½é´üʸ»úÎó ¥Æ¥¹¥Èʸ»úÎó/;
49 open STDIN, "<", $file0 or die "$file0:$!";
50 $obj = Mod_EUCJP->new;
54 is ($cmp[$i++], $_, "encoding vs. STDIN - $i");