OSDN Git Service

* Remove extra space.
[nkf/nkf.git] / test.pl
diff --git a/test.pl b/test.pl
index 58f6548..4b34800 100644 (file)
--- a/test.pl
+++ b/test.pl
 # nkf PDS version passes Basic Conversion tests  using "nkf -iB -oB "
 #
 
-$nkf = 'MSWin32' eq $^O ? ".\\nkf" : "./nkf";
+if ($ARGV[0]) {
+    $nkf = $ARGV[0];
+} else {
+    $nkf = 'MSWin32' eq $^O ? ".\\nkf" : "./nkf";
+}
 # $nkf = "doscmd nkf.exe";
 
 # If you want to see the testing process, set next flag.
@@ -36,10 +40,12 @@ sub command_test {
 
     $result = '';
     open(OUT,"> nkf.in");
+    binmode OUT;
     print OUT $in;
     close(OUT);
     system("$nkf <nkf.in >nkf.out");   # easy
     open(IN,"< nkf.out");
+    binmode IN;
     while(<IN>) {
        $result .= $_;
     }
@@ -63,12 +69,13 @@ sub command_test {
     system "mv nkf.in nkf.in.$error_count.bad";
     system "mv nkf.out nkf.out.$error_count.bad";
     open(OUT,"> nkf.expect.$error_count.bad");
+    binmode OUT;
     print OUT $ans;
     close(OUT);
     $error_count++;
     if ($diff) {
-       open(R,"|od -c >tmp.result.bad"); print R $result; close(R);
-       open(R,"|od -c >tmp.expect.bad"); print R $ans; close(R);
+       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);
        system "diff -c tmp.result.bad tmp.expect.bad";
     }
     return $result;