Skip to content

Commit cc145f5

Browse files
committed
sh/tests: Add a test for long line in history
1 parent 95e4fce commit cc145f5

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

bin/sh/tests/builtins/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ ${PACKAGE}FILES+= export1.0
9494
${PACKAGE}FILES+= fc1.0
9595
${PACKAGE}FILES+= fc2.0
9696
${PACKAGE}FILES+= fc3.0 fc3.0.stdout fc3.0.stderr
97+
${PACKAGE}FILES+= fc4.0
9798
${PACKAGE}FILES+= for1.0
9899
${PACKAGE}FILES+= for2.0
99100
${PACKAGE}FILES+= for3.0

bin/sh/tests/builtins/fc4.0

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
v=1234
2+
v=$v$v$v$v
3+
v=$v$v$v$v
4+
v=$v$v$v$v
5+
#v=$v$v$v$v
6+
v=beginlong$v$v$v${v}endlong
7+
result=$(ENV= HISTFILE=/dev/null script -q /dev/null ${SH} +m -i -o emacs <<EOF
8+
printf '%s\n' "$v"
9+
printf 'running %s\n' fc; fc -l
10+
EOF
11+
)
12+
case $result in
13+
*'running fc'*beginlong*endlong*) ;;
14+
*)
15+
set -x
16+
: result is "$result"
17+
exit 2
18+
esac
19+
result=${result#*running fc}
20+
result=${result#*beginlong}
21+
result=${result%endlong*}
22+
reflected=beginlong${result}endlong
23+
if [ "$v" != "$reflected" ]; then
24+
set -x
25+
: expected "$v" reflected "$reflected"
26+
exit 3
27+
fi

0 commit comments

Comments
 (0)