diff options
Diffstat (limited to 'test/misc.t')
-rwxr-xr-x | test/misc.t | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/misc.t b/test/misc.t index afb4b06..680ea6d 100755 --- a/test/misc.t +++ b/test/misc.t @@ -1,7 +1,7 @@ #!/usr/bin/perl # Requires perl-Test-Simple installation. -use Test::Simple tests => 18; +use Test::Simple tests => 22; $suffix = ""; if (-e "../dos2unix.exe") { @@ -56,24 +56,30 @@ $result = ($? >> 8); ok( $result == 1, 'Unix2dos stdio returns error on binary input.' ); system("rm -f out_forc.txt"); -system("$DOS2UNIX -v -n utf16len.txt out_forc.txt"); +system("$DOS2UNIX -f -v -n utf16len.txt out_forc.txt"); # file out_bin.txt may not exist. if (-e "out_forc.txt") { $exists = "1"; } else { $exists = "0"; } -ok( $exists == 0, 'dos2unix force binary file.' ); +ok( $exists == 1, 'dos2unix force binary file.' ); system("rm -f out_forc.txt"); -system("$UNIX2DOS -v -n utf16len.txt out_forc.txt"); +system("$UNIX2DOS -f -v -n utf16len.txt out_forc.txt"); # file out_bin.txt may not exist. if (-e "out_forc.txt") { $exists = "1"; } else { $exists = "0"; } -ok( $exists == 0, 'unix2dos force binary file.' ); +ok( $exists == 1, 'unix2dos force binary file.' ); + +system("$DOS2UNIX -v -f -n dos_bin.txt out_unix.txt; cmp out_unix.txt unix_bin.txt"); +ok( $? == 0, 'Dos2unix, force ASCII file with binary symbols' ); + +system("$UNIX2DOS -v -f -n unix_bin.txt out_dos.txt; cmp out_dos.txt dos_bin.txt"); +ok( $? == 0, 'Unix2dos, force ASCII file with binary symbols' ); system("$DOS2UNIX -v -7 -n utf16le.txt out_unix.txt chardos.txt out_u7.txt; cmp out_unix.txt utf8unix.txt"); ok( $? == 0, '7bit disabled for utf16'); @@ -94,5 +100,13 @@ system("$DOS2UNIX -i dos.txt unix.txt mac.txt mixed.txt utf16le.txt utf16be.txt system("$DOS2UNIX outinfo.txt; diff info.txt outinfo.txt"); ok( $? == 0, 'Option -i, --info'); +system("$DOS2UNIX -ul -i utf16le.txt utf16len.txt utf8unxb.txt gb18030.txt > outinfo.txt"); +system("$DOS2UNIX outinfo.txt; diff info_ul.txt outinfo.txt"); +ok( $? == 0, 'Option -i, --info combined with -ul'); + +system("$DOS2UNIX -ub -i utf16be.txt utf16ben.txt utf8unxb.txt gb18030.txt > outinfo.txt"); +system("$DOS2UNIX outinfo.txt; diff info_ub.txt outinfo.txt"); +ok( $? == 0, 'Option -i, --info combined with -ub'); + system("$DOS2UNIX -v -n gb18030.txt out_unix.txt; cmp out_unix.txt gb18030u.txt"); ok( $? == 0, 'Remove GB18030 BOM'); |