Export the symbols from #18863; do not prototype (but export)
[p5sagit/p5-mst-13.2.git] / ext / Encode / t / enc_module.t
CommitLineData
05ef2f67 1# $Id: enc_module.t,v 1.2 2003/03/09 17:32:43 dankogai Exp $
6be7c101 2# This file is in euc-jp
3BEGIN {
4 require Config; import Config;
5 if ($Config{'extensions'} !~ /\bEncode\b/) {
6 print "1..0 # Skip: Encode was not built\n";
7 exit 0;
8 }
9 unless (find PerlIO::Layer 'perlio') {
10 print "1..0 # Skip: PerlIO was not built\n";
11 exit 0;
12 }
05ef2f67 13 if (defined ${^UNICODE} and ${^UNICODE} != 0){
14 print "1..0 # Skip: \${^UNICODE} == ${^UNICODE}\n";
15 exit 0;
16 }
6be7c101 17 if (ord("A") == 193) {
18 print "1..0 # encoding pragma does not support EBCDIC platforms\n";
19 exit(0);
20 }
21}
22use lib 't';
23use lib qw(ext/Encode/t ../ext/Encode/t); # in case of perl core
24use Mod_EUCJP;
25use encoding "euc-jp";
26use Test::More tests => 3;
27use File::Basename;
28use File::Spec;
29use File::Compare qw(compare_text);
30
31my $dir = dirname(__FILE__);
32my $file0 = File::Spec->catfile($dir,"enc_module.enc");
33my $file1 = File::Spec->catfile($dir,"$$.enc");
34
35my $obj = Mod_EUCJP->new;
6be7c101 36local $SIG{__WARN__} = sub{}; # to silence reopening STD(IN|OUT) w/o closing
37
38open STDOUT, ">", $file1 or die "$file1:$!";
39print $obj->str, "\n";
40$obj->set("¥Æ¥¹¥Èʸ»úÎó");
41print $obj->str, "\n";
42close STDOUT;
43
44my $cmp = compare_text($file0, $file1);
45is($cmp, 0, "encoding vs. STDOUT");
46unlink $file1 unless $cmp;
47
48my @cmp = qw/½é´üʸ»úÎó ¥Æ¥¹¥Èʸ»úÎó/;
49open STDIN, "<", $file0 or die "$file0:$!";
50$obj = Mod_EUCJP->new;
51my $i = 0;
52while(<STDIN>){
53 chomp;
54 is ($cmp[$i++], $_, "encoding vs. STDIN - $i");
55}
56
57__END__
58