summaryrefslogtreecommitdiff
path: root/converters/nkf/patches/patch-ab
blob: 9b9a7e85d63cd2bbff35a1bf417aab7c7c61217f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$NetBSD: patch-ab,v 1.1 2009/01/22 08:50:12 obache Exp $

Fix: can't run test.
http://git.sourceforge.jp/view?p=nkf/nkf.git;a=commitdiff;h=b7ee1f1b26ba715116fd8f66e83bf1ad8a95bcce

--- NKF.mod/test.pl.orig	2009-01-20 09:49:31.000000000 +0000
+++ NKF.mod/test.pl
@@ -114,8 +114,35 @@ END {print "not ok 1\n" unless $loaded;}
     } else {
 	print "no 5\n";
     }
+}
 
+sub command_tests {
+    my @tests = @_;
+    my ($in, $out, $ans);
 
+    for (my $i = 0; $i <= $#tests; $i += 3){
+	local (@nkf) = split(/ /,$tests[$i]);
+	shift(@nkf);
+	$in = $tests[$i+1];
+	$ans = $tests[$i+2];
+        $out = NKF::nkf(@nkf,$in);
+	$out =~ s/ //g if $nkf =~ /-\w+m[NS]/o;
+	$ans =~ s/ //g if $nkf =~ /-\w+m[NS]/o;
+        if ($out ne $ans) {
+	    last;
+	}
+    }
+    if ($out eq $ans) {
+	print "Ok\n";
+	return;
+    }
+    print "Fail\n";
+    if ($diff) {
+	open(R,"|od -c >tmp.result.bad"); binmode R; print R $out; 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;
 }
 
 do "../nkf_test.pl";