##// 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 1 Tests of the file helper tool
2 2
3 3 $ f -h
4 4 Usage: f [options] [filenames]
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 #if symlink
41 42 $ f foo --mode
42 43 foo: mode=644
44 #endif
43 45
44 46 $ seq 10 > bar
47 #if unix-permissions symlink
45 48 $ chmod +x bar
46 49 $ f bar --newer foo --mode --type --size --dump --links --bytes 7
47 50 bar: file, size=21, mode=755, links=1, newer than foo
48 51 >>>
49 52 1
50 53 2
51 54 3
52 55 4
53 56 <<< no trailing newline
57 #endif
54 58
55 59 $ ln bar baz
56 60 $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20
57 61 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a
58 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 63 0010: 39 0a |9.|
60 64
65 #if unix-permissions symlink
61 66 $ ln -s yadda l
62 67 $ f . --recurse -MStmsB4
63 68 .: directory with 4 files, size=120, mode=755
64 69 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c
65 70 ./baz: file, size=21, mode=755, md5=3b03, sha1=612c
66 71 ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2
67 72 ./l: link, size=5, mode=777, md5=2faa, sha1=af93
73 #endif
68 74
69 75 $ f --quiet bar -DL 3
70 76 1
71 77 2
72 78 3
73 79
74 80 $ cd ..
75 81
82 Yadda is a symlink
83 #if symlink
76 84 $ f -qr dir -HB 17
77 85 dir: directory with 4 files
78 86 dir/bar:
79 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 88 0010: 39 |9|
81 89 dir/baz:
82 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 91 0010: 39 |9|
84 92 dir/foo:
85 93 0000: 66 6f 6f 0a |foo.|
86 94 dir/l:
87 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