Skip to content

Commit d4dbf57

Browse files
committed
Teach t0027 about native end-of-lines
Without this patch, t0027 expects the native end-of-lines to be a single line feed character. On Windows, however, we set it to a carriage return character followed by a line feed character. Thus, we have to modify t0027 to expect different warnings depending on the end-of-line markers. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent da12900 commit d4dbf57

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

t/t0027-auto-crlf.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ create_gitattributes () {
5555
esac
5656
}
5757

58+
# Some warnings depend on the native end-of-line marker
59+
60+
test_have_prereq NATIVE_CRLF &&
61+
NATIVE_CRLF=t ||
62+
NATIVE_CRLF=
63+
5864
check_warning () {
59-
case "$1" in
60-
LF_CRLF) grep "LF will be replaced by CRLF" $2;;
61-
CRLF_LF) grep "CRLF will be replaced by LF" $2;;
62-
'')
65+
case "$1,$NATIVE_CRLF" in
66+
LF_CRLF,*|MAYBE_CRLF,t|MIX,t) grep "LF will be replaced by CRLF" $2;;
67+
CRLF_LF,*|MAYBE_LF,|MIX,) grep "CRLF will be replaced by LF" $2;;
68+
,*|MAYBE_CRLF,|MAYBE_LF,t)
6369
>expect
6470
grep "will be replaced by" $2 >actual
6571
test_cmp expect actual
@@ -175,16 +181,17 @@ test_expect_success 'add files empty attr' '
175181
create_file_in_repo input "" "" "CRLF_LF" "CRLF_LF" "" ""
176182
'
177183

184+
178185
test_expect_success 'add files attr=auto' '
179-
create_file_in_repo false "auto" "" "CRLF_LF" "CRLF_LF" "" "" &&
180-
create_file_in_repo true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
181-
create_file_in_repo input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
186+
create_file_in_repo false "auto" "MAYBE_CRLF" "MAYBE_LF" "MIX" "" "" &&
187+
create_file_in_repo true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
188+
create_file_in_repo input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
182189
'
183190

184191
test_expect_success 'add files attr=text' '
185-
create_file_in_repo false "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
186-
create_file_in_repo true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
187-
create_file_in_repo input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
192+
create_file_in_repo false "text" "MAYBE_CRLF" "MAYBE_LF" "MIX" "MAYBE_CRLF" "MAYBE_LF" &&
193+
create_file_in_repo true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
194+
create_file_in_repo input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
188195
'
189196

190197
test_expect_success 'add files attr=-text' '

0 commit comments

Comments
 (0)