From 85e4fd3dfa004a6f0f871e23f449ceb94f0cef70 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Sat, 6 Nov 2004 04:34:49 +0000 Subject: [PATCH] add binmode and some changes. --- NKF.mod/test.pl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/NKF.mod/test.pl b/NKF.mod/test.pl index c03b534..b3cb928 100644 --- a/NKF.mod/test.pl +++ b/NKF.mod/test.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# nkf test program for nkf 1.7 +# nkf test program for nkf 2.0 # Shinji KONO # Sun Aug 18 12:25:40 JST 1996 # Sun Nov 8 00:16:06 JST 1998 @@ -46,23 +46,25 @@ sub library_test { if( $nkf =~ /-\S*m/) { $result =~ s/ //g; } - $i = 0; + $i = -1; foreach $ans (@ans) { + $i++; if( $nkf =~ /-\S*m/) { $ans =~ s/ //g; } - last if ($result eq $ans) ; - $i++; + if ($result eq $ans){ + print "Ok\n"; + return $result; + } } $ans = @ans[$i]; - print (($result eq $ans)?"Ok\n":"Fail\n"); + print "Fail\n"; if ($diff) { - if ($result ne $ans) { - open(R,"|od -c >tmp.result.bad"); print R $result; close(R); - open(R,"|od -c >tmp.expect.bad"); print R $ans; close(R); - system "diff -c tmp.result.bad tmp.expect.bad"; - } + open(R,"|od -c >tmp.result.bad"); binmode R; print R $result; close(R); + open(R,"|od -c >tmp.expect.bad"); binmode R; print R $ans; close(R); + print"$i\n;$result\n;$ans\n" if $nkf[0] eq'-w16B'; + system "diff -c tmp.result.bad tmp.expect.bad"; } return $result; } -- 2.11.0