mirror of
git://git.suckless.org/sbase
synced 2026-01-26 13:43:17 +00:00
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.
28 lines
386 B
Bash
Executable File
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
|