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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/usr/bin/perl
# Requires perl-Test-Simple installation.
use Test::Simple tests => 30;
$suffix = "";
if (-e "../dos2unix.exe") {
$suffix = ".exe";
}
$DOS2UNIX = "../dos2unix" . $suffix;
$MAC2UNIX = "../mac2unix" . $suffix;
$UNIX2DOS = "../unix2dos" . $suffix;
$UNIX2MAC = "../unix2mac" . $suffix;
system("$DOS2UNIX -v -n dos.txt out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'DOS to Unix conversion' );
system("$MAC2UNIX -v -n mac.txt out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'DOS to Unix conversion' );
system("$UNIX2DOS -v -n unix.txt out_dos.txt; cmp out_dos.txt dos.txt");
ok( $? == 0, 'Unix to DOS conversion' );
system("$UNIX2MAC -v -n unix.txt out_mac.txt; cmp out_mac.txt mac.txt");
ok( $? == 0, 'Unix to Mac conversion' );
system("cp -f dos.txt out_unix.txt; $DOS2UNIX -v out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'DOS to Unix conversion, old file mode' );
system("cp -f unix.txt out_dos.txt; $UNIX2DOS -v out_dos.txt; cmp out_dos.txt dos.txt");
ok( $? == 0, 'Unix to DOS conversion, old file mode' );
system("$DOS2UNIX -v -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'dos2unix must not change unix line breaks');
system("$DOS2UNIX -v -n mac.txt out_unix.txt; cmp out_unix.txt mac.txt");
ok( $? == 0, 'dos2unix must not change mac line breaks');
system("$MAC2UNIX -v -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'mac2unix must not change unix line breaks');
system("$MAC2UNIX -v -n dos.txt out_unix.txt; cmp out_unix.txt dos.txt");
ok( $? == 0, 'mac2unix must not change dos line breaks');
system("$UNIX2DOS -v -n dos.txt out_dos.txt; cmp out_dos.txt dos.txt");
ok( $? == 0, 'unix2dos must not change dos line breaks');
system("$UNIX2DOS -v -n mac.txt out_dos.txt; cmp out_dos.txt mac.txt");
ok( $? == 0, 'unix2dos must not change mac line breaks');
system("$UNIX2MAC -v -n dos.txt out_mac.txt; cmp out_mac.txt dos.txt");
ok( $? == 0, 'unix2mac must not change dos line breaks');
system("$UNIX2MAC -v -n mac.txt out_mac.txt; cmp out_mac.txt mac.txt");
ok( $? == 0, 'unix2mac must not change mac line breaks');
system("$DOS2UNIX -v -n mixed.txt out.txt; cmp out.txt mixedd2u.txt");
ok( $? == 0, 'DOS to Unix conversion mixed');
system("$MAC2UNIX -v -n mixed.txt out.txt; cmp out.txt mixedm2u.txt");
ok( $? == 0, 'DOS to Unix conversion mixed');
system("$UNIX2DOS -v -n mixed.txt out.txt; cmp out.txt mixedu2d.txt");
ok( $? == 0, 'Unix to DOS conversion mixed');
system("$UNIX2MAC -v -n mixed.txt out.txt; cmp out.txt mixedu2m.txt");
ok( $? == 0, 'Unix to Mac conversion mixed');
system("$DOS2UNIX -v -l -n dos.txt out_unix.txt; cmp out_unix.txt unix_dbl.txt");
ok( $? == 0, 'DOS to Unix conversion with line doubling');
system("$MAC2UNIX -v -l -n mac.txt out_unix.txt; cmp out_unix.txt unix_dbl.txt");
ok( $? == 0, 'DOS to Unix conversion with line doubling');
system("$UNIX2DOS -v -l -n unix.txt out_dos.txt; cmp out_dos.txt dos_dbl.txt");
ok( $? == 0, 'Unix to DOS conversion with line doubling');
system("$UNIX2MAC -v -l -n unix.txt out_mac.txt; cmp out_mac.txt mac_dbl.txt");
ok( $? == 0, 'Unix to Mac conversion with line doubling');
system("$DOS2UNIX -v -l -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'dos2unix -l must not change unix line breaks');
system("$DOS2UNIX -v -l -n mac.txt out_unix.txt; cmp out_unix.txt mac.txt");
ok( $? == 0, 'dos2unix -l must not change mac line breaks');
system("$MAC2UNIX -v -l -n unix.txt out_unix.txt; cmp out_unix.txt unix.txt");
ok( $? == 0, 'mac2unix -l must not change unix line breaks');
system("$MAC2UNIX -v -l -n dos.txt out_unix.txt; cmp out_unix.txt dos.txt");
ok( $? == 0, 'mac2unix -l must not change dos line breaks');
system("$UNIX2DOS -v -l -n dos.txt out_dos.txt; cmp out_dos.txt dos.txt");
ok( $? == 0, 'unix2dos -l must not change dos line breaks');
system("$UNIX2DOS -v -l -n mac.txt out_dos.txt; cmp out_dos.txt mac.txt");
ok( $? == 0, 'unix2dos -l must not change mac line breaks');
system("$UNIX2MAC -v -l -n dos.txt out_mac.txt; cmp out_mac.txt dos.txt");
ok( $? == 0, 'unix2mac -l must not change dos line breaks');
system("$UNIX2MAC -v -l -n mac.txt out_mac.txt; cmp out_mac.txt mac.txt");
ok( $? == 0, 'unix2mac -l must not change mac line breaks');
|