ls-tree tests: add tests for --name-status
The --name-status synonym for --name-only added in c639a5548a5 (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 <avarab@gmail.com> Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Mar 23, 2022 at 17:13 UTC
a53343e0fd72ee871aef994bf1352be320dbf710
1 file changed
+29
-26
t/t3101-ls-tree-dirname.sh
+29
-26
@@ -201,31 +201,34 @@ EOF
201
test_cmp expected check
202
'
203
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
233
234
test_done