ed: Split tests - sbase - suckless unix tools
 (HTM) git clone git://git.suckless.org/sbase
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0190f5e7bf8985af3ed768f7d17d192c23beb5d1
 (DIR) parent afa8975960633104311f9d81bf478171e950e26d
 (HTM) 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:
         M tests/0003-ed.sh                    |      38 -------------------------------
         A tests/0004-ed.sh                    |      33 +++++++++++++++++++++++++++++++
         A tests/0005-ed.sh                    |      34 +++++++++++++++++++++++++++++++
       
       3 files changed, 67 insertions(+), 38 deletions(-)
       ---
 (DIR) 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
 (DIR) 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
 (DIR) 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