########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2012 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# David Korn <dgk@research.att.com> #
# #
########################################################################
# the trickiest part of the tests is avoiding typeahead
# in the pty dialogue
function err_exit
{
print -u2 -n "\t"
}
alias err_exit='err_exit $lineno'
bintrue=$(whence -p true)
bintrue=$(whence -p true)
set -o monitor
{
eval $'set -o vi\npty $bintrue'
#sleep 1
jobs
kill $$
)
if [[ -o xtrace ]]
else debug=
fi
function tst
{
typeset text
while read -r text
fi
done
}
exit 0
fi
# err_exit #
# If the User Portability Utilities Option is supported: When the
# POSIX locale is specified and a background job is suspended by a
# SIGTSTP signal then the <state> field in the output message is set to
# Stopped, Suspended, Stopped(SIGTSTP) or Suspended(SIGTSTP).
I ^\r?\n$
p :test-1:
w sleep 60 &
u [[:digit:]]\r?\n$
s 100
p :test-2:
w kill -TSTP $!
p :test-3:
w kill -KILL $!
w wait
!
# err_exit #
# If the User Portability Utilities Option is supported: When the
# POSIX locale is specified and a background job is suspended by a
# SIGTTIN signal then the <state> field in the output message is set to
# Stopped(SIGTTIN) or Suspended(SIGTTIN).
I ^\r?\n$
p :test-1:
w sleep 60 &
u [[:digit:]]\r?\n$
s 100
p :test-2:
w kill -TTIN $!
p :test-3:
w kill -KILL $!
w wait
!
# err_exit #
# If the User Portability Utilities Option is supported: When the
# POSIX locale is specified and a background job is suspended by a
# SIGTTOU signal then the <state> field in the output message is set to
# Stopped(SIGTTOU) or Suspended(SIGTTOU).
I ^\r?\n$
p :test-1:
w sleep 60 &
u [[:digit:]]\r?\n$
s 100
p :test-2:
w kill -TTOU $!
p :test-3:
w kill -KILL $!
w wait
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode an entered
# character other than <newline>, erase, interrupt, kill, control-V,
# control-W, backslash \ (followed by erase or kill), end-of-file and
# <ESC> is inserted in the current command line.
c echo h
c ell
w o
u ^hello\r?\n$
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: After termination of a previous
# command, sh is entered in insert mode.
w echo hello
u ^hello\r?\n$
c echo goo
c dby
w e
u ^goodbye\r?\n$
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode an <ESC>
# switches sh into command mode.
c echo he\E
s 400
w allo
u ^hello\r?\n$
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in command mode the
# interrupt character causes sh to terminate command line editing on
# the current command line, re-issue the prompt on the next line of the
# terminal and to reset the command history so that the command that
# was interrupted is not entered in the history.
I ^\r?\n$
p :test-1:
w echo first
p :test-2:
p :test-3:
c echo bad\E
s 400
c \cC
w echo scrambled
p :test-4:
w history
u echo first
r echo
r history
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode a <newline>
# causes the current command line to be executed.
c echo ok\n
u ^ok\r?\n$
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode the interrupt
# character causes sh to terminate command line editing on the current
# command line, re-issue the prompt on the next line of the terminal
# and to reset the command history so that the command that was
# interrupted is not entered in the history.
I ^\r?\n$
p :test-1:
w echo first
u ^first
p :test-2:
r
p :test-3:
w echo last
p :test-4:
w history
u echo first
r echo last
r history
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode the kill
# character clears all the characters from the input line.
p :test-1:
w stty kill ^X
p :test-2:
w echo ok
u ^ok\r?\n$
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode a control-V
# causes the next character to be inserted even in the case that the
# character is a special insert mode character.
# Testing Requirements: The assertion must be tested with at least the
# following set of characters: <newline>, erase, interrupt, kill,
# control-V, control-W, end-of-file, backslash \ (followed by erase or
# kill) and <ESC>.
d 10
p :test-1:
p :test-2:
u ^erase=:\r?\n$
p :test-3:
u ^kill=:\cX:\r?\n$
p :test-4:
p :test-5:
p :test-6:
u ^EOF=:\004:\r?\n$
p :test-7:
p :test-8:
p :test-9:
u ^ESC=:\E:\r?\n$
p :test-10:
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in insert mode an
# end-of-file at the beginning of an input line is interpreted as the
# end of input.
p :test-1:
w trap 'echo done >&2' EXIT
p :test-2:
s 100
c \cD
u ^done\r?\n$
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in command mode, # inserts
# the character # at the beginning of the command line and causes the
# line to be treated as a comment and the line is entered in the
# command history.
p :test-1:
c echo save\E
s 400
c #
p :test-2:
w history
u #echo save
r history
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in command mode, then v
# invokes the vi editor to edit the current command line in a temporary
# file. When the editor exits, the commands in the temporary file are
# executed.
p :test-1:
c echo hello\E
s 400
c v
u /tmp/
c A world\E
s 400
w :wq
!
# err_exit #
# If the User Portability Utilities Option is supported and shell
# command line editing is supported: When in command mode, then the
# command N repeats the most recent / or ? command, reversing the
# direction of the search.
p :test-1:
w echo repeat-1
u ^repeat-1\r?\n$
p :test-2:
w echo repeat-2
u ^repeat-2\r?\n$
p :test-3:
s 100
c \E
s 400
w /rep
u echo repeat-2
c n
r echo repeat-1
c N
r echo repeat-2
w dd
p :test-3:
w echo repeat-3
u ^repeat-3\r?\n$
p :test-4:
s 100
c \E
s 400
w ?rep
r echo repeat-2
c N
r echo repeat-1
c n
r echo repeat-2
c n
r echo repeat-3
!
# err_exit #
whence -q less &&
u :$|:\E|lines
c \cZ
r Stopped
w fg
!