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