sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 0190f5e7bf8985af3ed768f7d17d192c23beb5d1
parent afa8975960633104311f9d81bf478171e950e26d
Author: Santtu Lakkala <inz@inz.fi>
Date:   Mon,  1 Dec 2025 17:02:51 +0200

ed: Split tests

Use multiple separate test scripts for ed to make it more obvious which
test failed.

Diffstat:
Mtests/0003-ed.sh | 38--------------------------------------
Atests/0004-ed.sh | 33+++++++++++++++++++++++++++++++++
Atests/0005-ed.sh | 34++++++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 38 deletions(-)

diff --git a/tests/0003-ed.sh b/tests/0003-ed.sh @@ -72,41 +72,3 @@ fizz foobar buzz EOF - -printf foo >$tmp1 -../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 - -../ed <<EOF >$tmp2 -i -foo -bar -. -,t -1t -2t -2,3t -3,7p -EOF - -diff -u - $tmp2 <<EOF -foo -bar -foo -bar -bar -EOF diff --git a/tests/0004-ed.sh b/tests/0004-ed.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +tmp1=tmp1.$$ +tmp2=tmp2.$$ + +cleanup() +{ + st=$? + rm -f $tmp1 $tmp2 + exit $st +} + +trap cleanup EXIT + +printf foo >$tmp1 +../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 diff --git a/tests/0005-ed.sh b/tests/0005-ed.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +tmp1=tmp1.$$ + +cleanup() +{ + st=$? + rm -f $tmp1 + exit $st +} + +trap cleanup EXIT + +../ed <<EOF >$tmp1 +i +foo +bar +. +,t +1t +2t +2,3t +3,7p +EOF + +diff -u - $tmp1 <<EOF +foo +bar +foo +bar +bar +EOF