[hackers] [sbase] ed: Split tests || Santtu Lakkala

From: <git_AT_suckless.org>
Date: Tue, 2 Dec 2025 09:24:45 +0100 (CET)

commit 0190f5e7bf8985af3ed768f7d17d192c23beb5d1
Author: Santtu Lakkala <inz_AT_inz.fi>
AuthorDate: Mon Dec 1 17:02:51 2025 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Tue Dec 2 09:23:47 2025 +0100

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

diff --git a/tests/0003-ed.sh b/tests/0003-ed.sh
index ee44132..f4a0acb 100755
--- a/tests/0003-ed.sh
+++ b/tests/0003-ed.sh
_AT_@ -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
new file mode 100755
index 0000000..fe8e998
--- /dev/null
+++ b/tests/0004-ed.sh
_AT_@ -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
new file mode 100755
index 0000000..7a55180
--- /dev/null
+++ b/tests/0005-ed.sh
_AT_@ -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
Received on Tue Dec 02 2025 - 09:24:45 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 02 2025 - 09:36:31 CET