X-Git-Url: http://git.sourceforge.jp/view?p=nkf%2Fnkf.git;a=blobdiff_plain;f=nkf_test.pl;h=da84c1b0047e5128a004cd191eae7d0acb94f396;hp=ce8f7cdd76023090fb8ed87ec57e8259acbf550a;hb=b66eee9290f343df2fd500dae09c7e6396034539;hpb=c27fc2150f2ec5daceca7f1726083042d39b5ae3 diff --git a/nkf_test.pl b/nkf_test.pl index ce8f7cd..da84c1b 100644 --- a/nkf_test.pl +++ b/nkf_test.pl @@ -1,6 +1,9 @@ #!/usr/local/bin/perl # -# nkf test program for nkf 1.7 +# nkf test program for nkf-2 +# +# $Id: nkf_test.pl,v 1.9 2004/12/01 01:59:28 naruse Exp $ +# # Shinji KONO # Sun Aug 18 12:25:40 JST 1996 # Sun Nov 8 00:16:06 JST 1998 @@ -40,13 +43,47 @@ MI?*E\R!+:6=O=2"AIJ'GH["CP:;!IMBGHJ?!J,`* eofeof -$example{'utf'} = unpack('u',<<'eofeof'); +$example{'utf8'} = unpack('u',<<'eofeof'); +M[[N_1FER(A#_(?^Q`\D#$00O!$(E"@`` +eofeof + +$example{'u16L0'} = unpack('u',<<'eofeof'); +M1@!I`'(`X0208 conversion # X0208 aphabet -> ASCII @@ -256,15 +361,15 @@ eofeof # -X is necessary to allow X0201 in SJIS # -Z convert X0208 alphabet to ASCII print "X0201 conversion: SJIS "; - &test("$nkf -XZ",$example{'x0201.sjis'},$example{'x0201.x0208'}); + &test("$nkf -jXZ",$example{'x0201.sjis'},$example{'x0201.x0208'}); print "X0201 conversion: JIS "; - &test("$nkf -Z",$example{'x0201.jis'},$example{'x0201.x0208'}); + &test("$nkf -jZ",$example{'x0201.jis'},$example{'x0201.x0208'}); print "X0201 conversion:SI/SO "; - &test("$nkf -Z",$example{'x0201.sosi'},$example{'x0201.x0208'}); + &test("$nkf -jZ",$example{'x0201.sosi'},$example{'x0201.x0208'}); print "X0201 conversion: EUC "; - &test("$nkf -Z",$example{'x0201.euc'},$example{'x0201.x0208'}); + &test("$nkf -jZ",$example{'x0201.euc'},$example{'x0201.x0208'}); print "X0201 conversion: UTF8 "; - &test("$nkf -Z",$example{'x0201.utf'},$example{'x0201.x0208'}); + &test("$nkf -jZ",$example{'x0201.utf'},$example{'x0201.x0208'}); # -x means X0201 output print "X0201 output: SJIS "; &test("$nkf -xs",$example{'x0201.euc'},$example{'x0201.sjis'}); @@ -342,7 +447,7 @@ eofeof # print "Next test is expected to Fail.\n"; print "MIME decode (strict) "; - $tmp = &test("$nkf -mS",$example{'mime.iso2022'},$example{'mime.ans.strict'}); + $tmp = &test("$nkf -jmS",$example{'mime.iso2022'},$example{'mime.ans.strict'}); $example{'mime.ans.alt'} = unpack('u',<<'eofeof'); M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11 @@ -359,14 +464,15 @@ H.WHD3C\I.W8T03MZ)$X_*3MV&RA""ALD0C1!.WHD3B5&)3DE)!LH0@`` eofeof print "MIME decode (nonstrict)"; - $tmp = &test("$nkf -mN",$example{'mime.iso2022'},$example{'mime.ans'},$example{'mime.ans.alt'}); + $tmp = &test("$nkf -jmN",$example{'mime.iso2022'},$example{'mime.ans'},$example{'mime.ans.alt'}); # open(OUT,">tmp1");print OUT pack('u',$tmp);close(OUT); # unbuf mode implies more pessimistic decode print "MIME decode (unbuf) "; - $tmp = &test("$nkf -mNu",$example{'mime.iso2022'},$example{'mime.unbuf'},$example{'mime.unbuf.alt'}); + $tmp = &test("$nkf -jmNu",$example{'mime.iso2022'},$example{'mime.unbuf'},$example{'mime.unbuf.alt'}); # open(OUT,">tmp2");print OUT pack('u',$tmp);close(OUT); print "MIME decode (base64) "; - &test("$nkf -mB",$example{'mime.base64'},$example{'mime.base64.ans'}); + &test("$nkf -jmB",$example{'mime.base64'},$example{'mime.base64.ans'}); +#MIME BASE64 must be LF? # MIME ISO-8859-1 @@ -404,7 +510,7 @@ $example{'test_data/cr.ans'} = unpack('u',<<'eofeof'); eofeof print "test_data/cr "; - &test("$nkf -d",$example{'test_data/cr'},$example{'test_data/cr.ans'}); + &test("$nkf -jd",$example{'test_data/cr'},$example{'test_data/cr.ans'}); # test_data/fixed-qencode $example{'test_data/fixed-qencode'} = unpack('u',<<'eofeof'); @@ -417,25 +523,29 @@ F("`@("`@("`;)$(^93\]&RA""B`@("`@("`@&R1"/F4_/1LH0@H` eofeof print "test_data/fixed-qencode "; - &test("$nkf -mQ",$example{'test_data/fixed-qencode'},$example{'test_data/fixed-qencode.ans'}); + &test("$nkf -jmQ",$example{'test_data/fixed-qencode'},$example{'test_data/fixed-qencode.ans'}); # test_data/long-fold-1 $example{'test_data/long-fold-1'} = unpack('u',<<'eofeof'); MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AHJ2SI.RD M\J2]I,ZDWJ3>I**DQ*2KI*:DR*&BI,FDIJ3BI-^DT*2HI*RD[Z3KI*2DMZ&B -MI,BDP:3EI*:DQZ3!I.>D\Z2NI.RDZZ2KI.*DMZ3SI,JDI*&C"J2SI+.DS\.[ -'I*2YU*&C"@`` +MI,BDP:3EI*:DQZ3!I.>D\Z2NI.RDZZ2KI.*DMZ3SI,JDI*&C"J2SI+.DSR!# +M4B],1B"DSKG4H:,-"J2SI+.DSR!#4B"DSKG4H:,-I+.DLZ3/($Q&+T-2(*3. +9N=2AHPH-"J2SI+.DSR!,1B"DSKG4H:,*"@`` eofeof $example{'test_data/long-fold-1.ans'} = unpack('u',<<'eofeof'); M&R1")$HD+"0D)$HD+"0D)$HD+"%!)"0D+B1G)"8D+"0B)&HD7B0W)$8A(B0S M)&PD)"(D1"0K&RA""ALD0B0F)$@A(B1))"8D8B1?)%`D*"0L M)&\D:R0D)#5)#2D-):TI#46U*0V=K2VE1 -M5%X2D1-:TY343-*1&MK3WAS;U%G/3T_/2`*(#T_25-/+3(P,C(M -M2E`_0C]'>5)#2D0P:U!Y4D)*15%K4FE224I%;VM3>5)-2D4P:U1I4E!*1DEK -M5E-264=Y:$,_/2`*(#T_25-/+3(P,C(M2E`_0C]'>5)#2D9S:UAI4F9*1T%K -M65-2:4I'46M*0U)M2D-G:V%"5)3 +M2D95:U=#4F)'>6A#/ST*(#T_25-/+3(P,C(M2E`_0C]'>5)#2D8T:UAY4F=* +M1T5K66E2:TI#46M::5%O2D=G8DM%23T_/0HM+2TM"E-U8FIE8W0Z(&%A86$@ +M86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$*(#T_25-/+3(P,C(M2E`_ +M0C]'>5)#2D-):TI#46U*0V=K2VAS;U%G/3T_/2!A86%A(&%A86$@86%A82!A +086%A"B!A86%A"BTM+2T*"@`` eofeof print "test_data/mime_out "; - &test("$nkf -M",$example{'test_data/mime_out'},$example{'test_data/mime_out.ans'}); -# test_data/multi-line + &test("$nkf -jM",$example{'test_data/mime_out'},$example{'test_data/mime_out.ans'}); +# test_data/mime_out2 + +$example{'test_data/mime_out2'} = unpack('u',<<'eofeof'); +M5&AI&ES=&EN +M9R!M97-S86=E(&AA;F1L:6YG('-O9G1W87)E+@H*4W5B:F5C=#H@=&5S=#$@ +M=&5S=#(@@L2"MX+&@J<@=&5S=#,@@L2"MX+&@O$@=&5S=#0*"E-U8FIE8W0Z +M('1EXSJ()/ZEGN,ZB!! +M4T-)22!!4T-)29/ZEGN,ZB!!4T-)20H*@J`@@J(@@J0@@J8@@J@@@JD@@JL@ +M@JT@@J\@@K$@@K,@@K4@@K<@@KD@@KL@@KT@@K\@@L(@@L0@@L8@@L@@@LD@ +8@LH@@LL@@LP*"@H*"@H*"@H*"@H*"@H* +eofeof + +$example{'test_data/mime_out2.ans'} = unpack('u',<<'eofeof'); +M5&AI5)#1WEH0TE" +M$Q81&AS1WEH0S\]($%30TE)($%30TE)"B`]/TE33RTR,#(R+4I0 +M/T(_1WE20U)N>$Q81&AS1WEH0TE"6A#24)S:U%I47)'>6A#24)S:U%I471'>6A#24)S:U%I +M479'>6A#/ST*(#T_25-/+3(P,C(M2E`_0C])0G-K46E1>$=Y:$-)0G-K46E1 +M>D=Y:$-)0G-K46E1,4=Y:$-)0G-K46E1,T=Y:$,_/0H@/3])4T\M,C`R,BU* +M4#]"/TE"6A#24)S:U%I +M4D5'>6A#24)S:U%I4D='>6A#24)S:U%I4DE'>6A#/ST*(#T_25-/+3(P,C(M +M2E`_0C])0G-K46E22T=Y:$-)0G-K46E23$=Y:$-)0G-K46E234=Y:$-)0G-K +M46E23D=Y:$,_/0H@/3])4T\M,C`R,BU*4#]"/TE"