README_DOCS.rst: update tg prev and tg next usage summary
[topgit/pro.git] / t / t1010-help-anywhere.sh
blob3068b3a85a78e53b49bcf840b126d62a0bd4b576
1 #!/bin/sh
3 test_description='tg help commands work anywhere
5 It should be possible to, for example, use `tg tag -h` outside a Git
6 repository without error.
9 TEST_NO_CREATE_REPO=1
11 . ./test-lib.sh
13 test_plan 11
15 test_expect_success 'test setup' '
16 mkdir norepo &&
17 test_create_repo repo
20 totalin="$PWD/ti"
21 totalout="$PWD/to"
22 fullin="$PWD/fi"
23 fullout="$PWD/fo"
24 briefin="$PWD/bi"
25 briefout="$PWD/bo"
27 test_expect_success 'total help in repo' '
28 cd repo &&
29 tg help tg >"$totalin"
32 test_expect_success 'total help outside repo' '
33 cd norepo &&
34 tg help tg >"$totalout"
37 test_expect_success 'total help okay' '
38 test -s "$totalin" &&
39 test -s "$totalout" &&
40 test_cmp "$totalin" "$totalout"
43 test_expect_success 'full help in repo' '
44 cd repo &&
45 tg help update >"$fullin"
48 test_expect_success 'full help outside repo' '
49 cd norepo &&
50 tg help update >"$fullout"
53 test_expect_success 'full help okay' '
54 test -s "$fullin" &&
55 test -s "$fullout" &&
56 test_cmp "$fullin" "$fullout"
59 test_expect_success 'brief help in repo' '
60 cd repo &&
61 tg update -h >"$briefin"
64 test_expect_success 'brief help outside repo' '
65 cd norepo &&
66 tg update -h >"$briefout"
69 test_expect_success 'brief help okay' '
70 test -s "$briefin" &&
71 test -s "$briefout" &&
72 test_cmp "$briefin" "$briefout"
75 test_expect_success 'sane help line counts' '
76 test_line_count -ge 1 "$briefout" &&
77 test_line_count -le 5 "$briefout" &&
78 test_line_count -ge 10 "$fullout" &&
79 test_line_count -lt 100 "$fullout" &&
80 test_line_count -gt 1000 "$totalout"
83 test_done