Skip to content

Commit ec8a896

Browse files
committed
t7508: .gitignore 'expect' and 'output' files
These files are used to observe the behaviour of the 'status' command and if there weren't any such observer, the expected output from 'status' wouldn't even mention them. Place them in .gitignore to unclutter the output expected by the tests. An added benefit is that future tests can add such files that are purely for use by the observer, i.e. the tests themselves, by naming them as expect-foo and/or output-bar. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9874fca commit ec8a896

File tree

1 file changed

+13
-65
lines changed

1 file changed

+13
-65
lines changed

t/t7508-status.sh

Lines changed: 13 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ strip_comments () {
6666
rm "$1" && mv "$1".tmp "$1"
6767
}
6868

69+
cat >.gitignore <<\EOF
70+
.gitignore
71+
expect*
72+
output*
73+
EOF
74+
6975
test_expect_success 'status --column' '
7076
cat >expect <<\EOF &&
7177
# On branch master
@@ -83,8 +89,8 @@ test_expect_success 'status --column' '
8389
# Untracked files:
8490
# (use "git add <file>..." to include in what will be committed)
8591
#
86-
# dir1/untracked dir2/untracked output
87-
# dir2/modified expect untracked
92+
# dir1/untracked dir2/untracked
93+
# dir2/modified untracked
8894
#
8995
EOF
9096
COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
@@ -116,8 +122,6 @@ cat >expect <<\EOF
116122
# dir1/untracked
117123
# dir2/modified
118124
# dir2/untracked
119-
# expect
120-
# output
121125
# untracked
122126
#
123127
EOF
@@ -167,8 +171,6 @@ Untracked files:
167171
dir1/untracked
168172
dir2/modified
169173
dir2/untracked
170-
expect
171-
output
172174
untracked
173175
174176
EOF
@@ -186,8 +188,6 @@ A dir2/added
186188
?? dir1/untracked
187189
?? dir2/modified
188190
?? dir2/untracked
189-
?? expect
190-
?? output
191191
?? untracked
192192
EOF
193193

@@ -320,7 +320,11 @@ EOF
320320
test_i18ncmp expect output
321321
'
322322

323-
rm -f .gitignore
323+
cat >.gitignore <<\EOF
324+
.gitignore
325+
expect*
326+
output*
327+
EOF
324328

325329
cat >expect <<\EOF
326330
## master
@@ -329,8 +333,6 @@ A dir2/added
329333
?? dir1/untracked
330334
?? dir2/modified
331335
?? dir2/untracked
332-
?? expect
333-
?? output
334336
?? untracked
335337
EOF
336338

@@ -434,8 +436,6 @@ Untracked files:
434436
dir2/modified
435437
dir2/untracked
436438
dir3/
437-
expect
438-
output
439439
untracked
440440
441441
EOF
@@ -456,8 +456,6 @@ A dir2/added
456456
?? dir2/modified
457457
?? dir2/untracked
458458
?? dir3/
459-
?? expect
460-
?? output
461459
?? untracked
462460
EOF
463461
test_expect_success 'status -s -unormal' '
@@ -493,8 +491,6 @@ Untracked files:
493491
dir2/untracked
494492
dir3/untracked1
495493
dir3/untracked2
496-
expect
497-
output
498494
untracked
499495
500496
EOF
@@ -518,8 +514,6 @@ A dir2/added
518514
?? dir1/untracked
519515
?? dir2/modified
520516
?? dir2/untracked
521-
?? expect
522-
?? output
523517
?? untracked
524518
EOF
525519
test_expect_success 'status -s -uall' '
@@ -554,8 +548,6 @@ Untracked files:
554548
untracked
555549
../dir2/modified
556550
../dir2/untracked
557-
../expect
558-
../output
559551
../untracked
560552
561553
EOF
@@ -569,8 +561,6 @@ A ../dir2/added
569561
?? untracked
570562
?? ../dir2/modified
571563
?? ../dir2/untracked
572-
?? ../expect
573-
?? ../output
574564
?? ../untracked
575565
EOF
576566
test_expect_success 'status -s with relative paths' '
@@ -586,8 +576,6 @@ A dir2/added
586576
?? dir1/untracked
587577
?? dir2/modified
588578
?? dir2/untracked
589-
?? expect
590-
?? output
591579
?? untracked
592580
EOF
593581

@@ -625,8 +613,6 @@ Untracked files:
625613
<BLUE>dir1/untracked<RESET>
626614
<BLUE>dir2/modified<RESET>
627615
<BLUE>dir2/untracked<RESET>
628-
<BLUE>expect<RESET>
629-
<BLUE>output<RESET>
630616
<BLUE>untracked<RESET>
631617
632618
EOF
@@ -647,8 +633,6 @@ cat >expect <<\EOF
647633
<BLUE>??<RESET> dir1/untracked
648634
<BLUE>??<RESET> dir2/modified
649635
<BLUE>??<RESET> dir2/untracked
650-
<BLUE>??<RESET> expect
651-
<BLUE>??<RESET> output
652636
<BLUE>??<RESET> untracked
653637
EOF
654638

@@ -676,8 +660,6 @@ cat >expect <<\EOF
676660
<BLUE>??<RESET> dir1/untracked
677661
<BLUE>??<RESET> dir2/modified
678662
<BLUE>??<RESET> dir2/untracked
679-
<BLUE>??<RESET> expect
680-
<BLUE>??<RESET> output
681663
<BLUE>??<RESET> untracked
682664
EOF
683665

@@ -694,8 +676,6 @@ A dir2/added
694676
?? dir1/untracked
695677
?? dir2/modified
696678
?? dir2/untracked
697-
?? expect
698-
?? output
699679
?? untracked
700680
EOF
701681

@@ -755,8 +735,6 @@ Untracked files:
755735
dir1/untracked
756736
dir2/modified
757737
dir2/untracked
758-
expect
759-
output
760738
untracked
761739
762740
EOF
@@ -772,8 +750,6 @@ A dir2/added
772750
?? dir1/untracked
773751
?? dir2/modified
774752
?? dir2/untracked
775-
?? expect
776-
?? output
777753
?? untracked
778754
EOF
779755

@@ -798,8 +774,6 @@ Untracked files:
798774
799775
dir1/untracked
800776
dir2/
801-
expect
802-
output
803777
untracked
804778
805779
EOF
@@ -848,8 +822,6 @@ Untracked files:
848822
dir1/untracked
849823
dir2/modified
850824
dir2/untracked
851-
expect
852-
output
853825
untracked
854826
855827
EOF
@@ -870,8 +842,6 @@ A sm
870842
?? dir1/untracked
871843
?? dir2/modified
872844
?? dir2/untracked
873-
?? expect
874-
?? output
875845
?? untracked
876846
EOF
877847
test_expect_success 'status -s submodule summary is disabled by default' '
@@ -913,8 +883,6 @@ Untracked files:
913883
dir1/untracked
914884
dir2/modified
915885
dir2/untracked
916-
expect
917-
output
918886
untracked
919887
920888
EOF
@@ -940,8 +908,6 @@ A sm
940908
?? dir1/untracked
941909
?? dir2/modified
942910
?? dir2/untracked
943-
?? expect
944-
?? output
945911
?? untracked
946912
EOF
947913
test_expect_success 'status -s submodule summary' '
@@ -964,8 +930,6 @@ Untracked files:
964930
dir1/untracked
965931
dir2/modified
966932
dir2/untracked
967-
expect
968-
output
969933
untracked
970934
971935
no changes added to commit (use "git add" and/or "git commit -a")
@@ -983,8 +947,6 @@ cat >expect <<EOF
983947
?? dir1/untracked
984948
?? dir2/modified
985949
?? dir2/untracked
986-
?? expect
987-
?? output
988950
?? untracked
989951
EOF
990952
test_expect_success 'status -s submodule summary (clean submodule)' '
@@ -1025,8 +987,6 @@ Untracked files:
1025987
dir1/untracked
1026988
dir2/modified
1027989
dir2/untracked
1028-
expect
1029-
output
1030990
untracked
1031991
1032992
EOF
@@ -1080,8 +1040,6 @@ Untracked files:
10801040
dir1/untracked
10811041
dir2/modified
10821042
dir2/untracked
1083-
expect
1084-
output
10851043
untracked
10861044
10871045
EOF
@@ -1192,8 +1150,6 @@ Untracked files:
11921150
dir1/untracked
11931151
dir2/modified
11941152
dir2/untracked
1195-
expect
1196-
output
11971153
untracked
11981154
11991155
EOF
@@ -1254,8 +1210,6 @@ Untracked files:
12541210
dir1/untracked
12551211
dir2/modified
12561212
dir2/untracked
1257-
expect
1258-
output
12591213
untracked
12601214
12611215
EOF
@@ -1336,8 +1290,6 @@ cat > expect << EOF
13361290
; dir1/untracked
13371291
; dir2/modified
13381292
; dir2/untracked
1339-
; expect
1340-
; output
13411293
; untracked
13421294
;
13431295
EOF
@@ -1369,8 +1321,6 @@ Untracked files:
13691321
dir1/untracked
13701322
dir2/modified
13711323
dir2/untracked
1372-
expect
1373-
output
13741324
untracked
13751325
13761326
no changes added to commit (use "git add" and/or "git commit -a")
@@ -1400,8 +1350,6 @@ Untracked files:
14001350
dir1/untracked
14011351
dir2/modified
14021352
dir2/untracked
1403-
expect
1404-
output
14051353
untracked
14061354
14071355
EOF

0 commit comments

Comments
 (0)