##// END OF EJS Templates
test-tools: another vfat fix
Matt Mackall -
r23915:5b20e4c3 default
parent child Browse files
Show More
@@ -1,110 +1,107
1 Tests of the file helper tool
1 Tests of the file helper tool
2
2
3 $ f -h
3 $ f -h
4 ?sage: f [options] [filenames] (glob)
4 ?sage: f [options] [filenames] (glob)
5
5
6 ?ptions: (glob)
6 ?ptions: (glob)
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 #if symlink
42 $ f foo --mode
42 $ f foo --mode
43 foo: mode=644
43 foo: mode=644
44 #endif
44 #endif
45
45
46 $ seq 10 > bar
46 $ seq 10 > bar
47 #if unix-permissions symlink
47 #if unix-permissions symlink
48 $ chmod +x bar
48 $ chmod +x bar
49 $ f bar --newer foo --mode --type --size --dump --links --bytes 7
49 $ f bar --newer foo --mode --type --size --dump --links --bytes 7
50 bar: file, size=21, mode=755, links=1, newer than foo
50 bar: file, size=21, mode=755, links=1, newer than foo
51 >>>
51 >>>
52 1
52 1
53 2
53 2
54 3
54 3
55 4
55 4
56 <<< no trailing newline
56 <<< no trailing newline
57 #endif
57 #endif
58
58
59 #if unix-permissions
59 #if unix-permissions
60 $ ln bar baz
60 $ ln bar baz
61 $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
61 $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
62 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
62 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
63 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.|
63 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.|
64 0010: 39 0a |9.|
64 0010: 39 0a |9.|
65 $ rm baz
65 #endif
66 #endif
66
67
67 #if unix-permissions symlink
68 #if unix-permissions symlink
68 $ ln -s yadda l
69 $ ln -s yadda l
69 $ f . --recurse -MStmsB4
70 $ f . --recurse -MStmsB4
70 .: directory with 4 files, mode=755
71 .: directory with 3 files, mode=755
71 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
72 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
72 ./baz: file, size=21, mode=755, md5=3b03, sha1=612c
73 ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
73 ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
74 ./l: link, size=5, md5=2faa, sha1=af93
74 ./l: link, size=5, md5=2faa, sha1=af93
75 #endif
75 #endif
76
76
77 $ f --quiet bar -DL 3
77 $ f --quiet bar -DL 3
78 1
78 1
79 2
79 2
80 3
80 3
81
81
82 $ cd ..
82 $ cd ..
83
83
84 Yadda is a symlink
84 Yadda is a symlink
85 #if symlink
85 #if symlink
86 $ f -qr dir -HB 17
86 $ f -qr dir -HB 17
87 dir: directory with 4 files
87 dir: directory with 3 files
88 dir/bar:
88 dir/bar:
89 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.|
89 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 0010: 39 |9|
90 0010: 39 |9|
91 dir/baz:
92 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.|
93 0010: 39 |9|
94 dir/foo:
91 dir/foo:
95 0000: 66 6f 6f 0a |foo.|
92 0000: 66 6f 6f 0a |foo.|
96 dir/l:
93 dir/l:
97 0000: 79 61 64 64 61 |yadda|
94 0000: 79 61 64 64 61 |yadda|
98 #else
95 #else
99 $ f -qr dir -HB 17
96 $ f -qr dir -HB 17
100 dir: directory with 3 files
97 dir: directory with 3 files
101 dir/bar: (glob)
98 dir/bar: (glob)
102 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.|
99 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.|
103 0010: 39 |9|
100 0010: 39 |9|
104 dir/baz: (glob)
101 dir/baz: (glob)
105 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.|
102 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.|
106 0010: 39 |9|
103 0010: 39 |9|
107 dir/foo: (glob)
104 dir/foo: (glob)
108 0000: 66 6f 6f 0a |foo.|
105 0000: 66 6f 6f 0a |foo.|
109 #endif
106 #endif
110
107
General Comments 0
You need to be logged in to leave comments. Login now