t1100: test tg migrate-bases command
[topgit/pro.git] / t / t1010-help-anywhere.sh
blob69975bec544de68fd2bc28662a8df6e39aeb9f12
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 GIT_CEILING_DIRECTORIES="$PWD" && export GIT_CEILING_DIRECTORIES
15 test_plan 11
17 test_expect_success 'test setup' '
18 mkdir norepo &&
19 test_create_repo repo
22 totalin="$PWD/ti"
23 totalout="$PWD/to"
24 fullin="$PWD/fi"
25 fullout="$PWD/fo"
26 briefin="$PWD/bi"
27 briefout="$PWD/bo"
29 test_expect_success 'total help in repo' '
30 cd repo &&
31 tg help tg >"$totalin"
34 test_expect_success 'total help outside repo' '
35 cd norepo &&
36 tg help tg >"$totalout"
39 test_expect_success 'total help okay' '
40 test -s "$totalin" &&
41 test -s "$totalout" &&
42 test_cmp "$totalin" "$totalout"
45 test_expect_success 'full help in repo' '
46 cd repo &&
47 tg help update >"$fullin"
50 test_expect_success 'full help outside repo' '
51 cd norepo &&
52 tg help update >"$fullout"
55 test_expect_success 'full help okay' '
56 test -s "$fullin" &&
57 test -s "$fullout" &&
58 test_cmp "$fullin" "$fullout"
61 test_expect_success 'brief help in repo' '
62 cd repo &&
63 tg update -h >"$briefin"
66 test_expect_success 'brief help outside repo' '
67 cd norepo &&
68 tg update -h >"$briefout"
71 test_expect_success 'brief help okay' '
72 test -s "$briefin" &&
73 test -s "$briefout" &&
74 test_cmp "$briefin" "$briefout"
77 test_expect_success 'sane help line counts' '
78 test_line_count -ge 1 "$briefout" &&
79 test_line_count -le 5 "$briefout" &&
80 test_line_count -ge 10 "$fullout" &&
81 test_line_count -lt 100 "$fullout" &&
82 test_line_count -gt 1000 "$totalout"
85 test_done