sbase/tests/0004-ed.sh
Roberto E. Vargas Caballero c02bf1a70d tests: USE $EXEC and fix ed path
Using an EXEC variable for every test make easy to run tools to
debug issues like for example using EXEC=valgrind ./0025-ed.sh.
Some tests for ed had a wrong path to the ed binary and they
were not testing the actual ed but the system one.
2026-01-13 12:11:16 +01:00

28 lines
386 B
Bash
Executable File

#!/bin/sh
set -e
tmp1=tmp1.$$
tmp2=tmp2.$$
trap 'rm -f $tmp1 $tmp2' EXIT
trap 'exit $?' HUP INT TERM
printf foo >$tmp1
$EXEC ../ed $tmp1 <<EOF >$tmp2
,p
w
EOF
# This is somewhat opinionated test for files without trailing newline, more
# documenting the current behavior, which differs from BSD and GNU eds.
diff -u - $tmp2 <<EOF || true
3
foo
4
EOF
diff -u - $tmp1 <<EOF
foo
EOF