summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 21:54:08 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 21:54:08 -0600
commit87c6a0f8f822c57b4f63bc8bb099a33307871414 (patch)
treebadd8a2f1485c15280cdf7c64a167b9ffd0e47c5 /tests
parentc980daddaa17460a65fe1ce7511b680279381dc1 (diff)
downloadzash-editor/one-editor.tar.gz
interactive: one editor, no libraryeditor/one-editor
libedit was a compile-time alternative (`make EDIT=libedit`). It goes: FreeBSD and NetBSD `sh` use it because it is in their base system, which is not the case on z/OS, and it cost about a third of a millisecond to reach the prompt -- three more shared libraries, `el_init()`, an `~/.editrc` read and a copy of the history -- for the same cost per key. What it bought was `~/.editrc` bindings and a kill ring; `bind` and the built-in editor's own bindings cover the keys, and a second editor meant a second build mode and a second set of interactive expectations, with seven tests skipping under it. Everything that existed only to serve two editors goes with it: the `EDIT` switch and the two `edit_$(EDIT)` paths in the makefile, the `$ZASH_EDITOR` variable the tests used to skip, the skip guards in `tests/linux/`, the NUL stripping in `ptydrive.py` that libedit's redraw needed, and the parallel paragraphs in README.md, DESIGN.md, bench/README.md and the two website pages. `bench/README.md` keeps the measurement, since that is why the decision is written in DESIGN.md. Checked on Linux (97 passed, 1 skipped, the one known local failure in linux/i-dscomplete) and on z/OS (64 passed, 3 skipped, 0 failed, plus the EBCDIC build).
Diffstat (limited to 'tests')
-rw-r--r--tests/linux/i-bind.sh6
-rw-r--r--tests/linux/i-dscomplete.sh6
-rw-r--r--tests/linux/i-emacs.sh6
-rw-r--r--tests/linux/i-history.sh6
-rw-r--r--tests/linux/i-prompt-esc.sh6
-rw-r--r--tests/linux/i-prompt.sh6
-rw-r--r--tests/linux/i-vi.sh6
-rw-r--r--tests/tools/ptydrive.py5
8 files changed, 1 insertions, 46 deletions
diff --git a/tests/linux/i-bind.sh b/tests/linux/i-bind.sh
index 6681701..8bbc872 100644
--- a/tests/linux/i-bind.sh
+++ b/tests/linux/i-bind.sh
@@ -1,11 +1,5 @@
# Interactive: `bind`, the key bindings of the BSD shells.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
# -l lists what the editor can run
send bind -l | grep -c up-history\r
diff --git a/tests/linux/i-dscomplete.sh b/tests/linux/i-dscomplete.sh
index d8b6d7a..14d5d44 100644
--- a/tests/linux/i-dscomplete.sh
+++ b/tests/linux/i-dscomplete.sh
@@ -3,12 +3,6 @@
# that is turned into real CSI work areas, PDS directory blocks and TIOT
# entries, so this drives the same decoding the z/OS build uses.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
{
echo "X SYS1"
echo "SYS1.MACLIB"
diff --git a/tests/linux/i-emacs.sh b/tests/linux/i-emacs.sh
index b1d0eb4..465b583 100644
--- a/tests/linux/i-emacs.sh
+++ b/tests/linux/i-emacs.sh
@@ -1,11 +1,5 @@
# Interactive: the built-in editor in emacs mode.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
# insert in the middle: ^A, ^F
send echo one two\x01\x06\x06\x06\x06\x06X\r
diff --git a/tests/linux/i-history.sh b/tests/linux/i-history.sh
index 1e83d7b..4ac00d4 100644
--- a/tests/linux/i-history.sh
+++ b/tests/linux/i-history.sh
@@ -1,11 +1,5 @@
# Interactive: history, fc, ^R, HISTFILE.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
printf 'echo from-file\n' >hist
PS1='$ ' ENV='' HISTFILE=$PWD/hist HISTSIZE=50 \
python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
diff --git a/tests/linux/i-prompt-esc.sh b/tests/linux/i-prompt-esc.sh
index 0169663..18efd07 100644
--- a/tests/linux/i-prompt-esc.sh
+++ b/tests/linux/i-prompt-esc.sh
@@ -8,12 +8,6 @@
# counts the title and the `(B` as text, keeps 7 columns too few, and the
# redraw after ^A shows a shorter window than this expectation.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
python3 "$TESTS/tools/ptydrive.py" -c 16 "$TSH" <<'END'
send PS1='\\e]0;t\x07\\e(B\\e[1;32mP\\e[0m> '\r
expect P>
diff --git a/tests/linux/i-prompt.sh b/tests/linux/i-prompt.sh
index ffbd914..9a04f4f 100644
--- a/tests/linux/i-prompt.sh
+++ b/tests/linux/i-prompt.sh
@@ -1,11 +1,5 @@
# Interactive: prompts.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
mkdir here && cd here || exit 1
PS1='$ ' PS2='more> ' ENV='' HISTFILE='' HOME=$PWD \
python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END'
diff --git a/tests/linux/i-vi.sh b/tests/linux/i-vi.sh
index 4cb503f..7e1edaa 100644
--- a/tests/linux/i-vi.sh
+++ b/tests/linux/i-vi.sh
@@ -1,11 +1,5 @@
# Interactive: the built-in editor in vi mode.
command -v python3 >/dev/null 2>&1 || exit 77
-# Keys, redraw and listings belong to the editor: libedit reads its keys
-# from ~/.editrc and draws in its own way, so this one is the built-in
-# editor's. tests/linux/i-complete covers the completion both share.
-case $("$TSH" -c 'echo "$ZASH_EDITOR"' 2>/dev/null) in
-libedit) exit 77 ;;
-esac
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" -o vi <<'END'
send echo hello world\x1b0wcwBYE\x1b\r
expect BYE world
diff --git a/tests/tools/ptydrive.py b/tests/tools/ptydrive.py
index ee1ebca..32503ee 100644
--- a/tests/tools/ptydrive.py
+++ b/tests/tools/ptydrive.py
@@ -90,9 +90,6 @@ def clean(data):
for ln in data.split(b"\n"):
parts = [p for p in ln.split(b"\r") if p]
lines.append(parts[-1] if parts else b"")
- data = b"\n".join(lines).replace(b"\x07", b"")
- # A NUL written to a terminal puts nothing on the screen; libedit emits
- # a run of them when it redraws a line after a completion.
- return data.replace(b"\x00", b"")
+ return b"\n".join(lines).replace(b"\x07", b"")
main()