1#!/bin/sh -
2#
3# Copyright (c) 1992 Diomidis Spinellis.
4# Copyright (c) 1992, 1993
5# The Regents of the University of California. All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
--- 20 unchanged lines hidden (view full) ---
29# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33# SUCH DAMAGE.
34#
35# @(#)sed.test 8.1 (Berkeley) 6/6/93
36#
37
38# sed Regression Tests
39#
40# The following files are created:
41# lines[1-4], script1, script2
42# Two directories *.out contain the test results
43
44main()
--- 380 unchanged lines hidden (view full) ---
425
426test_print()
427{
428 echo Testing print and file routines
429 awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
430 </dev/null >lines3
431 # GNU and SunOS sed behave differently here
432 mark '7.1'
433 if [ $BSD -eq 1 ] ; then
434 echo 'BSD sed drops core on this one; TEST SKIPPED'
435 else
436 $SED -n l lines3
437 fi
438 mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
439 rm -f lines4
440 mark '7.3' ; $SED -e '3,12w lines4' lines1
441 echo w results
442 cat lines4
443 mark '7.4' ; $SED -e '4r lines2' lines1
444 mark '7.5' ; $SED -e '5r /dev/dds' lines1
445 mark '7.6' ; $SED -e '6r /dev/null' lines1
--- 50 unchanged lines hidden (view full) ---
496 mark '8.14' ;
497 if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
498 echo BSD/GNU/SUN sed fail this test
499 else
500 $SED -e 'y10\123456789198765432\101' lines1
501 fi
502 mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
503 mark '8.16'
504 if [ $BSD -eq 1 ] ; then
505 echo 'BSD sed does not handle branch defined REs'
506 else
507 echo 'eeefff' | $SED -e 'p' -e 's/e/X/p' -e ':x' \
508 -e 's//Y/p' -e '/f/bx'
509 fi
510}
511
512test_error()
513{
514 exec 0>&3 4>&1 5>&2
515 exec 0</dev/null
516 exec 2>&1
517 set -x
--- 35 unchanged lines hidden ---
2#
3# Copyright (c) 1992 Diomidis Spinellis.
4# Copyright (c) 1992, 1993
5# The Regents of the University of California. All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
--- 20 unchanged lines hidden (view full) ---
29# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33# SUCH DAMAGE.
34#
35# @(#)sed.test 8.1 (Berkeley) 6/6/93
36#
37
38# sed Regression Tests
39#
40# The following files are created:
41# lines[1-4], script1, script2
42# Two directories *.out contain the test results
43
44main()
--- 380 unchanged lines hidden (view full) ---
425
426test_print()
427{
428 echo Testing print and file routines
429 awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
430 </dev/null >lines3
431 # GNU and SunOS sed behave differently here
432 mark '7.1'
433 if [ $BSD -eq 1 ] ; then
434 echo 'BSD sed drops core on this one; TEST SKIPPED'
435 else
436 $SED -n l lines3
437 fi
438 mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
439 rm -f lines4
440 mark '7.3' ; $SED -e '3,12w lines4' lines1
441 echo w results
442 cat lines4
443 mark '7.4' ; $SED -e '4r lines2' lines1
444 mark '7.5' ; $SED -e '5r /dev/dds' lines1
445 mark '7.6' ; $SED -e '6r /dev/null' lines1
--- 50 unchanged lines hidden (view full) ---
496 mark '8.14' ;
497 if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
498 echo BSD/GNU/SUN sed fail this test
499 else
500 $SED -e 'y10\123456789198765432\101' lines1
501 fi
502 mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
503 mark '8.16'
504 if [ $BSD -eq 1 ] ; then
505 echo 'BSD sed does not handle branch defined REs'
506 else
507 echo 'eeefff' | $SED -e 'p' -e 's/e/X/p' -e ':x' \
508 -e 's//Y/p' -e '/f/bx'
509 fi
510}
511
512test_error()
513{
514 exec 0>&3 4>&1 5>&2
515 exec 0</dev/null
516 exec 2>&1
517 set -x
--- 35 unchanged lines hidden ---