Skip to content

Commit f486dc4

Browse files
committed
bash: Add run-crlf tests
Note: This patch contains a line with CRLF. So, .gitattributes is also updated to keep the CRLF.
1 parent b13bf3a commit f486dc4

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

bash/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*-bash-*-msys2-fix-lineendings.patch -text

bash/0005-bash-4.3-msys2-fix-lineendings.patch

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,62 @@ index 2001b4e..3ba2029 100644
173173
}
174174
else
175175
break;
176+
diff --git a/tests/crlf.right b/tests/crlf.right
177+
new file mode 100644
178+
index 0000000..d7fd195
179+
--- /dev/null
180+
+++ b/tests/crlf.right
181+
@@ -0,0 +1,8 @@
182+
+Line with LF
183+
+Line with CR
184+
+Line with CRLF
185+
+Line with
186+
+ LF
187+
+Line with CR
188+
+Line with
189+
+ CRLF
190+
diff --git a/tests/crlf.tests b/tests/crlf.tests
191+
new file mode 100644
192+
index 0000000..b2c4da7
193+
--- /dev/null
194+
+++ b/tests/crlf.tests
195+
@@ -0,0 +1,6 @@
196+
+echo $(echo -e "Line with\n LF")
197+
+echo $(echo -e "Line with\r CR")
198+
+echo $(echo -e "Line with\r\n CRLF")
199+
+echo "$(echo -e "Line with\n LF")"
200+
+echo "$(echo -e "Line with\r CR")"
201+
+echo "$(echo -e "Line with\r\n CRLF")"
176202
diff --git a/tests/ps1lf.right b/tests/ps1lf.right
177203
new file mode 100644
178-
index 0000000..bbed883
204+
index 0000000..ee83131
179205
--- /dev/null
180206
+++ b/tests/ps1lf.right
181207
@@ -0,0 +1,2 @@
182208
+foo
183209
+$ exit
184-
diff --git a/tests/ps1lf.sub b/tests/ps1lf.sub
210+
diff --git a/tests/ps1lf.tests b/tests/ps1lf.tests
185211
new file mode 100644
186212
index 0000000..01a2265
187213
--- /dev/null
188-
+++ b/tests/ps1lf.sub
214+
+++ b/tests/ps1lf.tests
189215
@@ -0,0 +1 @@
190216
+PS1='$(echo foo)\n\$ '
217+
diff --git a/tests/run-crlf b/tests/run-crlf
218+
new file mode 100644
219+
index 0000000..3f6037c
220+
--- /dev/null
221+
+++ b/tests/run-crlf
222+
@@ -0,0 +1,2 @@
223+
+${THIS_SH} ./crlf.tests > ${BASH_TSTOUT}
224+
+diff ${BASH_TSTOUT} crlf.right && rm -f ${BASH_TSTOUT}
191225
diff --git a/tests/run-ps1lf b/tests/run-ps1lf
192226
new file mode 100644
193-
index 0000000..030f606
227+
index 0000000..1617108
194228
--- /dev/null
195229
+++ b/tests/run-ps1lf
196230
@@ -0,0 +1,2 @@
197-
+${THIS_SH} --rcfile ./ps1lf.sub -i < /dev/null 2>&1 | tr -d '\r' > ${BASH_TSTOUT}
231+
+${THIS_SH} --rcfile ./ps1lf.tests -i < /dev/null 2>&1 | tr -d '\r' > ${BASH_TSTOUT}
198232
+diff ${BASH_TSTOUT} ps1lf.right && rm -f ${BASH_TSTOUT}
199233
diff --git a/variables.c b/variables.c
200234
index 028667c..a10594d 100644

bash/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ sha256sums=('a139c166df7ff4471c5e0733051642ee5556c1cc8a4a78f145583c5c81ab32fb'
130130
'SKIP'
131131
'948b8b5401dcb4e5eb577cfa6543e740e2e3bd0690939d8e77d078d75d110097'
132132
'6ca7633a87db7caf1d2d1a96779681c365d0ad2c11b2ea758e772f4ebff2a62f'
133-
'2bac9a5f4da18bb7d31823c6f599216f2f14799d92e12a8c698b0f1ff16b2a20'
133+
'b598a3dcfab16eb2bd0cee4228a7f0041fc6f10892e5ffc9da1ae1c2e1d7570e'
134134
'500c75c64593a70276585345a55c807226c0cc220d08b7cccece2ab005b3bcea'
135135
'cbae1aa81d56eba4e916bdaf2b2983731d6e2537dd8d606a3b378e49bcb81e79'
136136
'f42f2fee923bc2209f406a1892772121c467f44533bedfe00a176139da5d310a'

0 commit comments

Comments
 (0)