3 # nkf test program for nkf 2.0
4 # Shinji KONO <kono@ie.u-ryukyu.ac.jp>
5 # Sun Aug 18 12:25:40 JST 1996
6 # Sun Nov 8 00:16:06 JST 1998
7 # Sun Sep 8 14:03:28 JST 2002
9 # This is useful when you add new patch on nkf.
10 # Since this test is too strict, faileurs may not mean
14 # nkf 1.5 differs on MIME decoding
15 # nkf 1.4 passes Basic Conversion tests
16 # nkf PDS version passes Basic Conversion tests using "nkf -iB -oB "
20 # $nkf = "doscmd nkf.exe";
22 # If you want to see the testing process, set next flag.
34 local ($nkf,$in,@ans) = @_;
38 # $nkf =~ s/^[^_]* //;
39 local (@nkf) = split(/ /,$nkf);
41 print "\nINPUT:\n",$in if ($detail || $detail_all);
42 print "\nEXPECT:\n", $ans if ($detail || $detail_all);
43 $result = NKF::nkf(@nkf,$in);
44 print "\nGOT:\n",$result if ($detail || $detail_all);
46 if( $nkf =~ /-\S*m/) {
52 if( $nkf =~ /-\S*m/) {
64 open(R,"|od -c >tmp.result.bad"); binmode R; print R $result; close(R);
65 open(R,"|od -c >tmp.expect.bad"); binmode R; print R $ans; close(R);
66 print"$i\n;$result\n;$ans\n" if $nkf[0] eq'-w16B';
67 system "diff -c tmp.result.bad tmp.expect.bad";
73 BEGIN { $| = 1; print "1..3\n"; }
74 END {print "not ok 1\n" unless $loaded;}
79 ######################### End of black magic.
81 # Insert your test code below (better if it prints "ok 13"
82 # (correspondingly "not ok 13") depending on the success of chunk 13
85 if ( nkf("-m","-e","1") ) {
91 $output = nkf("\033\$@#1#3#2%B");
99 $output = nkf("-Zj","\033\$@#1#3#2%B");
101 # print $output,"\n";
107 # conversion makes strings longer
108 $output = "\244\306 " x 1024;
109 $old = length($output);
110 $output = nkf("-j",$output);
112 # print $output,"\n";
113 print "ok 5 $old ",length($output),"\n";