test-lib*.sh: set GIT_CEILING_DIRECTORIES
[topgit/pro.git] / t / t1000-usage-and-version.sh
blob1bf45d3c916f9b54973f5d164954566c16787962
1 #!/bin/sh
3 test_description='basic tg do-nothing commands work anywhere
5 The basic `tg version` `tg precheck` and friends should all work just fine
6 in or not in a Git repository without complaint.
9 TEST_NO_CREATE_REPO=1
11 . ./test-lib.sh
13 GIT_CEILING_DIRECTORIES="$PWD" && export GIT_CEILING_DIRECTORIES
15 test_plan 8
17 test_expect_success 'test setup' '
18 mkdir norepo &&
19 test_create_repo repo
22 test_expect_success 'version' '
23 (cd norepo && test -n "$(tg version)") &&
24 (cd repo && test -n "$(tg version)")
27 test_expect_success 'precheck' '
28 (cd norepo && tg precheck) &&
29 (cd repo && tg precheck)
32 test_expect_success 'hook include' '
33 tg__include=1 && export tg__include &&
34 (cd norepo && test_might_fail tg 2>/dev/null) &&
35 (cd repo && tg)
38 test_expect_success 'hooks path' '
39 (cd norepo && test -d "$(tg --hooks-path)") &&
40 (cd repo && test -d "$(tg --hooks-path)")
43 test_expect_success 'help outside repo' '
44 cd norepo &&
45 tg help >/dev/null &&
46 tg -h >/dev/null &&
47 tg --help >/dev/null &&
48 tg help tg >/dev/null
51 test_expect_success 'help inside repo' '
52 cd repo &&
53 tg help >/dev/null &&
54 tg -h >/dev/null &&
55 tg --help >/dev/null &&
56 tg help tg >/dev/null
59 test_expect_success 'bad options' '
61 cd norepo &&
62 test_must_fail tg --no-such-option &&
63 test_must_fail tg -r &&
64 test_must_fail tg -C &&
65 test_must_fail tg -c
66 ) >/dev/null 2>&1 &&
68 cd repo &&
69 test_must_fail tg --no-such-option &&
70 test_must_fail tg -r &&
71 test_must_fail tg -C &&
72 test_must_fail tg -c
73 ) >/dev/null 2>&1
76 test_done