3 test_description
='Test git stash show configuration.'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
12 # takes three parameters:
13 # 1. the stash.showStat value (or "<unset>")
14 # 2. the stash.showPatch value (or "<unset>")
15 # 3. the diff options of the expected output (or nothing for no output)
16 test_stat_and_patch
() {
17 if test "<unset>" = "$1"
19 test_unconfig stash.showStat
21 test_config stash.showStat
"$1"
24 if test "<unset>" = "$2"
26 test_unconfig stash.showPatch
28 test_config stash.showPatch
"$2"
38 git stash show
>actual
&&
42 test_must_be_empty actual
44 test_cmp expect actual
48 test_expect_success
'showStat unset showPatch unset' '
49 test_stat_and_patch "<unset>" "<unset>" --stat
52 test_expect_success
'showStat unset showPatch false' '
53 test_stat_and_patch "<unset>" false --stat
56 test_expect_success
'showStat unset showPatch true' '
57 test_stat_and_patch "<unset>" true --stat -p
60 test_expect_success
'showStat false showPatch unset' '
61 test_stat_and_patch false "<unset>"
64 test_expect_success
'showStat false showPatch false' '
65 test_stat_and_patch false false
68 test_expect_success
'showStat false showPatch true' '
69 test_stat_and_patch false true -p
72 test_expect_success
'showStat true showPatch unset' '
73 test_stat_and_patch true "<unset>" --stat
76 test_expect_success
'showStat true showPatch false' '
77 test_stat_and_patch true false --stat
80 test_expect_success
'showStat true showPatch true' '
81 test_stat_and_patch true true --stat -p