Debian Codegraph @

test/stdio.t

raw
1 #!/usr/bin/perl
2
3 # Requires perl-Test-Simple installation.
4 use Test::Simple tests => 7;
5
6 $suffix = "";
7 if (-e "../dos2unix.exe") {
8 $suffix = ".exe";
9 }
10 $DOS2UNIX = "../dos2unix" . $suffix;
11 $MAC2UNIX = "../mac2unix" . $suffix;
12 $UNIX2DOS = "../unix2dos" . $suffix;
13 $UNIX2MAC = "../unix2mac" . $suffix;
14
15 $ENV{'LC_ALL'} = 'C';
16
17 system("$DOS2UNIX -v < dos.txt > out_unix.txt; cmp out_unix.txt unix.txt");
18 ok( $? == 0, 'DOS to Unix conversion, stdin/out' );
19
20 system("$UNIX2DOS -v < unix.txt > out_dos.txt; cmp out_dos.txt dos.txt");
21 ok( $? == 0, 'Unix to DOS conversion, stdin/out' );
22
23 system("$DOS2UNIX -v -O dos.txt > out_unix.txt; cmp out_unix.txt unix.txt");
24 ok( $? == 0, 'DOS to Unix conversion, to stdout' );
25
26 system("$UNIX2DOS -v -O unix.txt > out_dos.txt; cmp out_dos.txt dos.txt");
27 ok( $? == 0, 'Unix to DOS conversion, to stdout' );
28
29 system("$DOS2UNIX -v -e -O noeol_dos_utf8.txt noeol_dos_utf8.txt > out_unix.txt; cmp out_unix.txt eol_unix2.txt");
30 ok( $? == 0, 'convert and concatenate two utf8 files' );
31
32 system("$DOS2UNIX -v -e -O noeol_dos_utf16.txt noeol_dos_utf16.txt > out_unix.txt; cmp out_unix.txt eol_unix2.txt");
33 ok( $? == 0, 'convert and concatenate two utf16 files' );
34
35 system("$DOS2UNIX -v -n dos.txt out1.txt -O dos.txt > out2.txt; cmp out2.txt unix.txt");
36 ok( $? == 0, 'To stdout after paired conversion' );