##// END OF EJS Templates
tests: conditionalize test-tools.t for Windows support...
Matt Harbison -
r23867:049a9e3a default
parent child Browse files
Show More
@@ -1,87 +1,108 b''
1 Tests of the file helper tool
1 Tests of the file helper tool
2
2
3 $ f -h
3 $ f -h
4 Usage: f [options] [filenames]
4 Usage: f [options] [filenames]
5
5
6 Options:
6 Options:
7 -h, --help show this help message and exit
7 -h, --help show this help message and exit
8 -t, --type show file type (file or directory)
8 -t, --type show file type (file or directory)
9 -m, --mode show file mode
9 -m, --mode show file mode
10 -l, --links show number of links
10 -l, --links show number of links
11 -s, --size show size of file
11 -s, --size show size of file
12 -n NEWER, --newer=NEWER
12 -n NEWER, --newer=NEWER
13 check if file is newer (or same)
13 check if file is newer (or same)
14 -r, --recurse recurse into directories
14 -r, --recurse recurse into directories
15 -S, --sha1 show sha1 hash of the content
15 -S, --sha1 show sha1 hash of the content
16 -M, --md5 show md5 hash of the content
16 -M, --md5 show md5 hash of the content
17 -D, --dump dump file content
17 -D, --dump dump file content
18 -H, --hexdump hexdump file content
18 -H, --hexdump hexdump file content
19 -B BYTES, --bytes=BYTES
19 -B BYTES, --bytes=BYTES
20 number of characters to dump
20 number of characters to dump
21 -L LINES, --lines=LINES
21 -L LINES, --lines=LINES
22 number of lines to dump
22 number of lines to dump
23 -q, --quiet no default output
23 -q, --quiet no default output
24
24
25 $ mkdir dir
25 $ mkdir dir
26 $ cd dir
26 $ cd dir
27
27
28 $ f --size
28 $ f --size
29 size=0
29 size=0
30
30
31 $ echo hello | f --md5 --size
31 $ echo hello | f --md5 --size
32 size=6, md5=b1946ac92492d2347c6235b4d2611184
32 size=6, md5=b1946ac92492d2347c6235b4d2611184
33
33
34 $ f foo
34 $ f foo
35 foo: file not found
35 foo: file not found
36
36
37 $ echo foo > foo
37 $ echo foo > foo
38 $ f foo
38 $ f foo
39 foo:
39 foo:
40
40
41 #if symlink
41 $ f foo --mode
42 $ f foo --mode
42 foo: mode=644
43 foo: mode=644
44 #endif
43
45
44 $ seq 10 > bar
46 $ seq 10 > bar
47 #if unix-permissions symlink
45 $ chmod +x bar
48 $ chmod +x bar
46 $ f bar --newer foo --mode --type --size --dump --links --bytes 7
49 $ f bar --newer foo --mode --type --size --dump --links --bytes 7
47 bar: file, size=21, mode=755, links=1, newer than foo
50 bar: file, size=21, mode=755, links=1, newer than foo
48 >>>
51 >>>
49 1
52 1
50 2
53 2
51 3
54 3
52 4
55 4
53 <<< no trailing newline
56 <<< no trailing newline
57 #endif
54
58
55 $ ln bar baz
59 $ ln bar baz
56 $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
60 $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
57 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
61 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
58 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
62 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
59 0010: 39 0a |9.|
63 0010: 39 0a |9.|
60
64
65 #if unix-permissions symlink
61 $ ln -s yadda l
66 $ ln -s yadda l
62 $ f . --recurse -MStmsB4
67 $ f . --recurse -MStmsB4
63 .: directory with 4 files, size=120, mode=755
68 .: directory with 4 files, size=120, mode=755
64 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
69 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
65 ./baz: file, size=21, mode=755, md5=3b03, sha1=612c
70 ./baz: file, size=21, mode=755, md5=3b03, sha1=612c
66 ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
71 ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
67 ./l: link, size=5, mode=777, md5=2faa, sha1=af93
72 ./l: link, size=5, mode=777, md5=2faa, sha1=af93
73 #endif
68
74
69 $ f --quiet bar -DL 3
75 $ f --quiet bar -DL 3
70 1
76 1
71 2
77 2
72 3
78 3
73
79
74 $ cd ..
80 $ cd ..
75
81
82 Yadda is a symlink
83 #if symlink
76 $ f -qr dir -HB 17
84 $ f -qr dir -HB 17
77 dir: directory with 4 files
85 dir: directory with 4 files
78 dir/bar:
86 dir/bar:
79 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
87 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
80 0010: 39 |9|
88 0010: 39 |9|
81 dir/baz:
89 dir/baz:
82 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
90 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
83 0010: 39 |9|
91 0010: 39 |9|
84 dir/foo:
92 dir/foo:
85 0000: 66 6f 6f 0a |foo.|
93 0000: 66 6f 6f 0a |foo.|
86 dir/l:
94 dir/l:
87 0000: 79 61 64 64 61 |yadda|
95 0000: 79 61 64 64 61 |yadda|
96 #else
97 $ f -qr dir -HB 17
98 dir: directory with 3 files
99 dir/bar: (glob)
100 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
101 0010: 39 |9|
102 dir/baz: (glob)
103 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.|
104 0010: 39 |9|
105 dir/foo: (glob)
106 0000: 66 6f 6f 0a |foo.|
107 #endif
108
General Comments 0
You need to be logged in to leave comments. Login now