11#! /bin/sh
22
3- test_description=' test env- -helper'
3+ test_description=' test test-tool env -helper'
44
55TEST_PASSES_SANITIZE_LEAK=true
66. ./test-lib.sh
77
88
9- test_expect_success ' env- -helper usage' '
10- test_must_fail git env- -helper &&
11- test_must_fail git env- -helper --type=bool &&
12- test_must_fail git env- -helper --type=ulong &&
13- test_must_fail git env- -helper --type=bool &&
14- test_must_fail git env- -helper --type=bool --default &&
15- test_must_fail git env- -helper --type=bool --default= &&
16- test_must_fail git env- -helper --defaultxyz
9+ test_expect_success ' test-tool env -helper usage' '
10+ test_must_fail test-tool env-helper &&
11+ test_must_fail test-tool env-helper --type=bool &&
12+ test_must_fail test-tool env-helper --type=ulong &&
13+ test_must_fail test-tool env-helper --type=bool &&
14+ test_must_fail test-tool env-helper --type=bool --default &&
15+ test_must_fail test-tool env-helper --type=bool --default= &&
16+ test_must_fail test-tool env-helper --defaultxyz
1717'
1818
19- test_expect_success ' env- -helper bad default values' '
20- test_must_fail git env- -helper --type=bool --default=1xyz MISSING &&
21- test_must_fail git env- -helper --type=ulong --default=1xyz MISSING
19+ test_expect_success ' test-tool env -helper bad default values' '
20+ test_must_fail test-tool env-helper --type=bool --default=1xyz MISSING &&
21+ test_must_fail test-tool env-helper --type=ulong --default=1xyz MISSING
2222'
2323
24- test_expect_success ' env- -helper --type=bool' '
24+ test_expect_success ' test-tool env -helper --type=bool' '
2525 # Test various --default bool values
2626 echo true >expected &&
27- git env- -helper --type=bool --default=1 MISSING >actual &&
27+ test-tool env-helper --type=bool --default=1 MISSING >actual &&
2828 test_cmp expected actual &&
29- git env- -helper --type=bool --default=yes MISSING >actual &&
29+ test-tool env-helper --type=bool --default=yes MISSING >actual &&
3030 test_cmp expected actual &&
31- git env- -helper --type=bool --default=true MISSING >actual &&
31+ test-tool env-helper --type=bool --default=true MISSING >actual &&
3232 test_cmp expected actual &&
3333 echo false >expected &&
34- test_must_fail git env- -helper --type=bool --default=0 MISSING >actual &&
34+ test_must_fail test-tool env-helper --type=bool --default=0 MISSING >actual &&
3535 test_cmp expected actual &&
36- test_must_fail git env- -helper --type=bool --default=no MISSING >actual &&
36+ test_must_fail test-tool env-helper --type=bool --default=no MISSING >actual &&
3737 test_cmp expected actual &&
38- test_must_fail git env- -helper --type=bool --default=false MISSING >actual &&
38+ test_must_fail test-tool env-helper --type=bool --default=false MISSING >actual &&
3939 test_cmp expected actual &&
4040
4141 # No output with --exit-code
42- git env- -helper --type=bool --default=true --exit-code MISSING >actual.out 2>actual.err &&
42+ test-tool env-helper --type=bool --default=true --exit-code MISSING >actual.out 2>actual.err &&
4343 test_must_be_empty actual.out &&
4444 test_must_be_empty actual.err &&
45- test_must_fail git env- -helper --type=bool --default=false --exit-code MISSING >actual.out 2>actual.err &&
45+ test_must_fail test-tool env-helper --type=bool --default=false --exit-code MISSING >actual.out 2>actual.err &&
4646 test_must_be_empty actual.out &&
4747 test_must_be_empty actual.err &&
4848
4949 # Existing variable
50- EXISTS=true git env- -helper --type=bool --default=false --exit-code EXISTS >actual.out 2>actual.err &&
50+ EXISTS=true test-tool env-helper --type=bool --default=false --exit-code EXISTS >actual.out 2>actual.err &&
5151 test_must_be_empty actual.out &&
5252 test_must_be_empty actual.err &&
5353 test_must_fail \
5454 env EXISTS=false \
55- git env- -helper --type=bool --default=true --exit-code EXISTS >actual.out 2>actual.err &&
55+ test-tool env-helper --type=bool --default=true --exit-code EXISTS >actual.out 2>actual.err &&
5656 test_must_be_empty actual.out &&
5757 test_must_be_empty actual.err
5858'
5959
60- test_expect_success ' env- -helper --type=ulong' '
60+ test_expect_success ' test-tool env -helper --type=ulong' '
6161 echo 1234567890 >expected &&
62- git env- -helper --type=ulong --default=1234567890 MISSING >actual.out 2>actual.err &&
62+ test-tool env-helper --type=ulong --default=1234567890 MISSING >actual.out 2>actual.err &&
6363 test_cmp expected actual.out &&
6464 test_must_be_empty actual.err &&
6565
6666 echo 0 >expected &&
67- test_must_fail git env- -helper --type=ulong --default=0 MISSING >actual &&
67+ test_must_fail test-tool env-helper --type=ulong --default=0 MISSING >actual &&
6868 test_cmp expected actual &&
6969
70- git env- -helper --type=ulong --default=1234567890 --exit-code MISSING >actual.out 2>actual.err &&
70+ test-tool env-helper --type=ulong --default=1234567890 --exit-code MISSING >actual.out 2>actual.err &&
7171 test_must_be_empty actual.out &&
7272 test_must_be_empty actual.err &&
7373
74- EXISTS=1234567890 git env- -helper --type=ulong --default=0 EXISTS --exit-code >actual.out 2>actual.err &&
74+ EXISTS=1234567890 test-tool env-helper --type=ulong --default=0 EXISTS --exit-code >actual.out 2>actual.err &&
7575 test_must_be_empty actual.out &&
7676 test_must_be_empty actual.err &&
7777
7878 echo 1234567890 >expected &&
79- EXISTS=1234567890 git env- -helper --type=ulong --default=0 EXISTS >actual.out 2>actual.err &&
79+ EXISTS=1234567890 test-tool env-helper --type=ulong --default=0 EXISTS >actual.out 2>actual.err &&
8080 test_cmp expected actual.out &&
8181 test_must_be_empty actual.err
8282'
8383
84- test_expect_success ' env- -helper reads config thanks to trace2' '
84+ test_expect_success ' test-tool env -helper reads config thanks to trace2' '
8585 mkdir home &&
8686 git config -f home/.gitconfig include.path cycle &&
8787 git config -f home/cycle include.path .gitconfig &&
@@ -93,7 +93,7 @@ test_expect_success 'env--helper reads config thanks to trace2' '
9393
9494 test_must_fail \
9595 env HOME="$(pwd)/home" GIT_TEST_ENV_HELPER=true \
96- git -C cycle env- -helper --type=bool --default=0 --exit-code GIT_TEST_ENV_HELPER 2>err &&
96+ test-tool -C cycle env-helper --type=bool --default=0 --exit-code GIT_TEST_ENV_HELPER 2>err &&
9797 grep "exceeded maximum include depth" err
9898'
9999
0 commit comments