On 10/12/2017 12:06 AM, Junio C Hamano wrote:
Jameson Miller <jameson.mille...@gmail.com> writes:

Add tests for status handling of '--ignored=matching` and
`--untracked-files=normal`.

Signed-off-by: Jameson Miller <jam...@microsoft.com>
---
Hmph, having some tests in 3/5, changes in 4/5 and even more tests
in 5/5 makes me as a reader a bit confused, as the description for
these two test patches does not make it clear how they are related
and how they are different.  Is it that changes in 1/5 alone does
not fulfill the promise made by documentation added at 2/5 so 3/5
only has tests for behaviour that works with 1/5 alone but is broken
with respect to what 2/5 claims until 4/5 is applied, and these "not
working with 1/5 alone, but works after 4/5" are added in this step?

Correct. The changes in 1/5 are to implement "--ignored=matching"
with "--untracked-files=all" with corresponding tests in 3/5. The
changes in 4/5 are to implement "--ignored=matching"
with "--untracked-files=normal" and the corresponding tests are
in 5/5.

Do you have a preference on how I organized this work? I see
several possible ways to split up this work. Maybe it would be
less confusing to have the implementation in the first two
commits, then 1 commit with all the tests, and then a commit with
the documentation? I think it makes sense to have the logic for
the different flag combinations split into their own commits, but
I am open to any suggestions.


  t/t7519-ignored-mode.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/t/t7519-ignored-mode.sh b/t/t7519-ignored-mode.sh
index 76e91427b0..6be7701d79 100755
--- a/t/t7519-ignored-mode.sh
+++ b/t/t7519-ignored-mode.sh
@@ -116,10 +116,68 @@ test_expect_success 'Verify status behavior on ignored 
folder containing tracked
                ignored_dir/ignored_1.ign ignored_dir/ignored_2.ign \
                ignored_dir/tracked &&
        git add -f ignored_dir/tracked &&
-       test_tick &&
        git commit -m "Force add file in ignored directory" &&
        git status --porcelain=v2 --ignored=matching --untracked-files=all >output 
&&
        test_i18ncmp expect output
  '
+test_expect_success 'Verify matching ignored files with --untracked-files=normal' '
+       test_when_finished "git clean -fdx" &&
+       cat >expect <<-\EOF &&
+       ? expect
+       ? output
+       ? untracked_dir/
+       ! ignored_dir/
+       ! ignored_files/ignored_1.ign
+       ! ignored_files/ignored_2.ign
+       EOF
+
+       mkdir ignored_dir ignored_files untracked_dir &&
+       touch ignored_dir/ignored_1 ignored_dir/ignored_2 \
+               ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
+               untracked_dir/untracked &&
+       git status --porcelain=v2 --ignored=matching --untracked-files=normal >output 
&&
+       test_i18ncmp expect output
+'
+
+test_expect_success 'Verify matching ignored files with 
--untracked-files=normal' '
+       test_when_finished "git clean -fdx" &&
+       cat >expect <<-\EOF &&
+       ? expect
+       ? output
+       ? untracked_dir/
+       ! ignored_dir/
+       ! ignored_files/ignored_1.ign
+       ! ignored_files/ignored_2.ign
+       EOF
+
+       mkdir ignored_dir ignored_files untracked_dir &&
+       touch ignored_dir/ignored_1 ignored_dir/ignored_2 \
+               ignored_files/ignored_1.ign ignored_files/ignored_2.ign \
+               untracked_dir/untracked &&
+       git status --porcelain=v2 --ignored=matching --untracked-files=normal >output 
&&
+       test_i18ncmp expect output
+'
+
+test_expect_success 'Verify status behavior on ignored folder containing 
tracked file' '
+       test_when_finished "git clean -fdx && git reset HEAD~1 --hard" &&
+       cat >expect <<-\EOF &&
+       ? expect
+       ? output
+       ! ignored_dir/ignored_1
+       ! ignored_dir/ignored_1.ign
+       ! ignored_dir/ignored_2
+       ! ignored_dir/ignored_2.ign
+       EOF
+
+       mkdir ignored_dir &&
+       touch ignored_dir/ignored_1 ignored_dir/ignored_2 \
+               ignored_dir/ignored_1.ign ignored_dir/ignored_2.ign \
+               ignored_dir/tracked &&
+       git add -f ignored_dir/tracked &&
+       git commit -m "Force add file in ignored directory" &&
+       git status --porcelain=v2 --ignored=matching --untracked-files=normal >output 
&&
+       test_i18ncmp expect output
+'
+
  test_done

Reply via email to