]>
Commit | Line | Data |
---|---|---|
b3b18d16 HW |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test advise_if_enabled functionality' | |
4 | ||
956d2e46 | 5 | TEST_PASSES_SANITIZE_LEAK=true |
b3b18d16 HW |
6 | . ./test-lib.sh |
7 | ||
8 | test_expect_success 'advice should be printed when config variable is unset' ' | |
9 | cat >expect <<-\EOF && | |
10 | hint: This is a piece of advice | |
11 | hint: Disable this message with "git config advice.nestedTag false" | |
12 | EOF | |
13 | test-tool advise "This is a piece of advice" 2>actual && | |
1108cea7 | 14 | test_cmp expect actual |
b3b18d16 HW |
15 | ' |
16 | ||
17 | test_expect_success 'advice should be printed when config variable is set to true' ' | |
18 | cat >expect <<-\EOF && | |
19 | hint: This is a piece of advice | |
b3b18d16 HW |
20 | EOF |
21 | test_config advice.nestedTag true && | |
22 | test-tool advise "This is a piece of advice" 2>actual && | |
1108cea7 | 23 | test_cmp expect actual |
b3b18d16 HW |
24 | ' |
25 | ||
26 | test_expect_success 'advice should not be printed when config variable is set to false' ' | |
27 | test_config advice.nestedTag false && | |
28 | test-tool advise "This is a piece of advice" 2>actual && | |
29 | test_must_be_empty actual | |
30 | ' | |
31 | ||
32 | test_done |