sh/tests: Add a test for long line in history

This commit is contained in:
Jilles Tjoelker
2026-05-22 16:07:20 +02:00
parent 95e4fce8f0
commit cc145f5d84
2 changed files with 28 additions and 0 deletions
+1
View File
@@ -94,6 +94,7 @@ ${PACKAGE}FILES+= export1.0
${PACKAGE}FILES+= fc1.0
${PACKAGE}FILES+= fc2.0
${PACKAGE}FILES+= fc3.0 fc3.0.stdout fc3.0.stderr
${PACKAGE}FILES+= fc4.0
${PACKAGE}FILES+= for1.0
${PACKAGE}FILES+= for2.0
${PACKAGE}FILES+= for3.0
+27
View File
@@ -0,0 +1,27 @@
v=1234
v=$v$v$v$v
v=$v$v$v$v
v=$v$v$v$v
#v=$v$v$v$v
v=beginlong$v$v$v${v}endlong
result=$(ENV= HISTFILE=/dev/null script -q /dev/null ${SH} +m -i -o emacs <<EOF
printf '%s\n' "$v"
printf 'running %s\n' fc; fc -l
EOF
)
case $result in
*'running fc'*beginlong*endlong*) ;;
*)
set -x
: result is "$result"
exit 2
esac
result=${result#*running fc}
result=${result#*beginlong}
result=${result%endlong*}
reflected=beginlong${result}endlong
if [ "$v" != "$reflected" ]; then
set -x
: expected "$v" reflected "$reflected"
exit 3
fi