---
tests/0003-ed.sh | 112 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
create mode 100755 tests/0003-ed.sh
diff --git a/tests/0003-ed.sh b/tests/0003-ed.sh
new file mode 100755
index 0000000..cb7a0e1
--- /dev/null
+++ b/tests/0003-ed.sh
_AT_@ -0,0 +1,112 @@
+#!/bin/sh
+
+set -e
+
+tmp1=tmp1.$$
+tmp2=tmp2.$$
+
+cleanup()
+{
+ st=$?
+ rm -f $tmp1 $tmp2
+ exit $st
+}
+
+trap cleanup EXIT HUP INT TERM
+
+cat <<EOF >$tmp1
+foo
+bar
+
+baz
+EOF
+
+# Unspecified whether quit with a dirty buffer is considered an error, allow both
+../ed $tmp1 <<EOF >$tmp2 || test $? -eq 1
+v#^\$#p
+p
+g/^\$/d
+,p
+q
+a
+fizz
+buzz
+.
+i
+foobar
+.
+w
+v!z\$!d
+,p
+q
+1,2j
+1,2j
+,p
+q
+EOF
+
+diff -u - $tmp2 <<EOF
+13
+foo
+bar
+baz
+baz
+foo
+bar
+baz
+?
+29
+baz
+fizz
+buzz
+?
+bazfizzbuzz
+?
+EOF
+
+diff -u - $tmp1 <<EOF
+foo
+bar
+baz
+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
--
2.42.0
Received on Thu Nov 20 2025 - 14:27:54 CET
This archive was generated by hypermail 2.3.0 : Thu Nov 20 2025 - 14:36:37 CET