3 # Requires perl-Test-Simple installation.
4 use Test::More tests => 30;
7 if (-e "../dos2unix.exe") {
10 $DOS2UNIX = "../dos2unix" . $suffix;
11 $MAC2UNIX = "../mac2unix" . $suffix;
12 $UNIX2DOS = "../unix2dos" . $suffix;
13 $UNIX2MAC = "../unix2mac" . $suffix;
15 system("$DOS2UNIX -v -n dos.txt out_unix.txt; cmp out_unix.txt unix.txt");
16 ok( $? == 0, 'DOS to Unix conversion' );
18 system("$MAC2UNIX -v -n mac.txt out_unix.txt; cmp out_unix.txt unix.txt");
19 ok( $? == 0, 'DOS to Unix conversion' );
21 system("$UNIX2DOS -v -n unix.txt out_dos.txt; cmp out_dos.txt dos.txt");
22 ok( $? == 0, 'Unix to DOS conversion' );
24 system("$UNIX2MAC -v -n unix.txt out_mac.txt; cmp out_mac.txt mac.txt");
25 ok( $? == 0, 'Unix to Mac conversion' );
27 system("cp -f dos.txt out_unix.txt; $DOS2UNIX -v out_unix.txt; cmp out_unix.txt unix.txt");
28 ok( $? == 0, 'DOS to Unix conversion, old file mode' );
30 system("cp -f unix.txt out_dos.txt; $UNIX2DOS -v out_dos.txt; cmp out_dos.txt dos.txt");
31 ok( $? == 0, 'Unix to DOS conversion, old file mode' );
33 system("$DOS2UNIX -v -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
34 ok( $? == 0, 'dos2unix must not change unix line breaks');
35 system("$DOS2UNIX -v -n mac.txt out_unix.txt; cmp out_unix.txt mac.txt");
36 ok( $? == 0, 'dos2unix must not change mac line breaks');
37 system("$MAC2UNIX -v -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
38 ok( $? == 0, 'mac2unix must not change unix line breaks');
39 system("$MAC2UNIX -v -n dos.txt out_unix.txt; cmp out_unix.txt dos.txt");
40 ok( $? == 0, 'mac2unix must not change dos line breaks');
41 system("$UNIX2DOS -v -n dos.txt out_dos.txt; cmp out_dos.txt dos.txt");
42 ok( $? == 0, 'unix2dos must not change dos line breaks');
43 system("$UNIX2DOS -v -n mac.txt out_dos.txt; cmp out_dos.txt mac.txt");
44 ok( $? == 0, 'unix2dos must not change mac line breaks');
45 system("$UNIX2MAC -v -n dos.txt out_mac.txt; cmp out_mac.txt dos.txt");
46 ok( $? == 0, 'unix2mac must not change dos line breaks');
47 system("$UNIX2MAC -v -n mac.txt out_mac.txt; cmp out_mac.txt mac.txt");
48 ok( $? == 0, 'unix2mac must not change mac line breaks');
50 system("$DOS2UNIX -v -n mixed.txt out.txt; cmp out.txt mixedd2u.txt");
51 ok( $? == 0, 'DOS to Unix conversion mixed');
52 system("$MAC2UNIX -v -n mixed.txt out.txt; cmp out.txt mixedm2u.txt");
53 ok( $? == 0, 'DOS to Unix conversion mixed');
54 system("$UNIX2DOS -v -n mixed.txt out.txt; cmp out.txt mixedu2d.txt");
55 ok( $? == 0, 'Unix to DOS conversion mixed');
56 system("$UNIX2MAC -v -n mixed.txt out.txt; cmp out.txt mixedu2m.txt");
57 ok( $? == 0, 'Unix to Mac conversion mixed');
59 system("$DOS2UNIX -v -l -n dos.txt out_unix.txt; cmp out_unix.txt unix_dbl.txt");
60 ok( $? == 0, 'DOS to Unix conversion with line doubling');
61 system("$MAC2UNIX -v -l -n mac.txt out_unix.txt; cmp out_unix.txt unix_dbl.txt");
62 ok( $? == 0, 'DOS to Unix conversion with line doubling');
63 system("$UNIX2DOS -v -l -n unix.txt out_dos.txt; cmp out_dos.txt dos_dbl.txt");
64 ok( $? == 0, 'Unix to DOS conversion with line doubling');
65 system("$UNIX2MAC -v -l -n unix.txt out_mac.txt; cmp out_mac.txt mac_dbl.txt");
66 ok( $? == 0, 'Unix to Mac conversion with line doubling');
68 system("$DOS2UNIX -v -l -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
69 ok( $? == 0, 'dos2unix -l must not change unix line breaks');
70 system("$DOS2UNIX -v -l -n mac.txt out_unix.txt; cmp out_unix.txt mac.txt");
71 ok( $? == 0, 'dos2unix -l must not change mac line breaks');
72 system("$MAC2UNIX -v -l -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
73 ok( $? == 0, 'mac2unix -l must not change unix line breaks');
74 system("$MAC2UNIX -v -l -n dos.txt out_unix.txt; cmp out_unix.txt dos.txt");
75 ok( $? == 0, 'mac2unix -l must not change dos line breaks');
76 system("$UNIX2DOS -v -l -n dos.txt out_dos.txt; cmp out_dos.txt dos.txt");
77 ok( $? == 0, 'unix2dos -l must not change dos line breaks');
78 system("$UNIX2DOS -v -l -n mac.txt out_dos.txt; cmp out_dos.txt mac.txt");
79 ok( $? == 0, 'unix2dos -l must not change mac line breaks');
80 system("$UNIX2MAC -v -l -n dos.txt out_mac.txt; cmp out_mac.txt dos.txt");
81 ok( $? == 0, 'unix2mac -l must not change dos line breaks');
82 system("$UNIX2MAC -v -l -n mac.txt out_mac.txt; cmp out_mac.txt mac.txt");
83 ok( $? == 0, 'unix2mac -l must not change mac line breaks');