The branch main has been updated by jilles:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cc145f5d8425f19fbe07110fed89ecde8d70ce78

commit cc145f5d8425f19fbe07110fed89ecde8d70ce78
Author:     Jilles Tjoelker <[email protected]>
AuthorDate: 2026-05-22 14:07:20 +0000
Commit:     Jilles Tjoelker <[email protected]>
CommitDate: 2026-05-24 17:06:08 +0000

    sh/tests: Add a test for long line in history
---
 bin/sh/tests/builtins/Makefile |  1 +
 bin/sh/tests/builtins/fc4.0    | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile
index 0246009cce81..9e9ee098e90a 100644
--- a/bin/sh/tests/builtins/Makefile
+++ b/bin/sh/tests/builtins/Makefile
@@ -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
diff --git a/bin/sh/tests/builtins/fc4.0 b/bin/sh/tests/builtins/fc4.0
new file mode 100644
index 000000000000..5213289fcd11
--- /dev/null
+++ b/bin/sh/tests/builtins/fc4.0
@@ -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

Reply via email to