Git 2.43.4
[git.git] / t / t0018-advice.sh
blobc13057a4ca3be22e431771fd60d5ab0325349bdc
1 #!/bin/sh
3 test_description='Test advise_if_enabled functionality'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
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 &&
14 test_cmp expect actual
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
20 hint: Disable this message with "git config advice.nestedTag false"
21 EOF
22 test_config advice.nestedTag true &&
23 test-tool advise "This is a piece of advice" 2>actual &&
24 test_cmp expect actual
27 test_expect_success 'advice should not be printed when config variable is set to false' '
28 test_config advice.nestedTag false &&
29 test-tool advise "This is a piece of advice" 2>actual &&
30 test_must_be_empty actual
33 test_done