Skip to content

Commit a53343e

Browse files
avargitster
authored andcommitted
ls-tree tests: add tests for --name-status
The --name-status synonym for --name-only added in c639a55 (ls-tree: --name-only, 2005-12-01) had no tests, let's make sure it works the same way as its sibling. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Teng Long <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cd3e606 commit a53343e

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

t/t3101-ls-tree-dirname.sh

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -201,31 +201,34 @@ EOF
201201
test_cmp expected check
202202
'
203203

204-
test_expect_success 'ls-tree --name-only' '
205-
git ls-tree --name-only $tree >current &&
206-
cat >expected <<\EOF &&
207-
1.txt
208-
2.txt
209-
path0
210-
path1
211-
path2
212-
path3
213-
EOF
214-
test_output
215-
'
216-
217-
test_expect_success 'ls-tree --name-only -r' '
218-
git ls-tree --name-only -r $tree >current &&
219-
cat >expected <<\EOF &&
220-
1.txt
221-
2.txt
222-
path0/a/b/c/1.txt
223-
path1/b/c/1.txt
224-
path2/1.txt
225-
path3/1.txt
226-
path3/2.txt
227-
EOF
228-
test_output
229-
'
204+
for opt in --name-only --name-status
205+
do
206+
test_expect_success "ls-tree $opt" '
207+
git ls-tree $opt $tree >current &&
208+
cat >expected <<-\EOF &&
209+
1.txt
210+
2.txt
211+
path0
212+
path1
213+
path2
214+
path3
215+
EOF
216+
test_output
217+
'
218+
219+
test_expect_success "ls-tree $opt -r" '
220+
git ls-tree $opt -r $tree >current &&
221+
cat >expected <<-\EOF &&
222+
1.txt
223+
2.txt
224+
path0/a/b/c/1.txt
225+
path1/b/c/1.txt
226+
path2/1.txt
227+
path3/1.txt
228+
path3/2.txt
229+
EOF
230+
test_output
231+
'
232+
done
230233

231234
test_done

0 commit comments

Comments
 (0)