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# $FreeBSD: head/tools/regression/usr.bin/sed/multitest.t 117900 2003-07-22 19:22:08Z dds $
38#
39
40# sed Regression Tests
41#
42# The following files are created:
43# lines[1-4], script1, script2
44# Two directories *.out contain the test results
45
46main()
--- 380 unchanged lines hidden (view full) ---
427
428test_print()
429{
430 echo Testing print and file routines
431 awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
432 </dev/null >lines3
433 # GNU and SunOS sed behave differently here
434 mark '7.1'
435 $SED -n l lines3
436 mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
437 rm -f lines4
438 mark '7.3' ; $SED -e '3,12w lines4' lines1
439 echo w results
440 cat lines4
441 mark '7.4' ; $SED -e '4r lines2' lines1
442 mark '7.5' ; $SED -e '5r /dev/dds' lines1
443 mark '7.6' ; $SED -e '6r /dev/null' lines1
--- 50 unchanged lines hidden (view full) ---
494 mark '8.14' ;
495 if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
496 echo BSD/GNU/SUN sed fail this test
497 else
498 $SED -e 'y10\123456789198765432\101' lines1
499 fi
500 mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
501 mark '8.16'
502 echo 'eeefff' | $SED -e '
503 p
504 s/e/X/p
505 :x
506 s//Y/p
507 # Establish limit counter in the hold space
508 # GNU sed version 3.02 enters into an infinite loop here
509 x
510 /.\{10\}/ {
511 s/.*/ERROR/
512 b
513 }
514 s/.*/&./
515 x
516 /f/bx
517 '
518}
519
520test_error()
521{
522 exec 0>&3 4>&1 5>&2
523 exec 0</dev/null
524 exec 2>&1
525 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# $FreeBSD: head/tools/regression/usr.bin/sed/multitest.t 117900 2003-07-22 19:22:08Z dds $
38#
39
40# sed Regression Tests
41#
42# The following files are created:
43# lines[1-4], script1, script2
44# Two directories *.out contain the test results
45
46main()
--- 380 unchanged lines hidden (view full) ---
427
428test_print()
429{
430 echo Testing print and file routines
431 awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
432 </dev/null >lines3
433 # GNU and SunOS sed behave differently here
434 mark '7.1'
435 $SED -n l lines3
436 mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
437 rm -f lines4
438 mark '7.3' ; $SED -e '3,12w lines4' lines1
439 echo w results
440 cat lines4
441 mark '7.4' ; $SED -e '4r lines2' lines1
442 mark '7.5' ; $SED -e '5r /dev/dds' lines1
443 mark '7.6' ; $SED -e '6r /dev/null' lines1
--- 50 unchanged lines hidden (view full) ---
494 mark '8.14' ;
495 if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
496 echo BSD/GNU/SUN sed fail this test
497 else
498 $SED -e 'y10\123456789198765432\101' lines1
499 fi
500 mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
501 mark '8.16'
502 echo 'eeefff' | $SED -e '
503 p
504 s/e/X/p
505 :x
506 s//Y/p
507 # Establish limit counter in the hold space
508 # GNU sed version 3.02 enters into an infinite loop here
509 x
510 /.\{10\}/ {
511 s/.*/ERROR/
512 b
513 }
514 s/.*/&./
515 x
516 /f/bx
517 '
518}
519
520test_error()
521{
522 exec 0>&3 4>&1 5>&2
523 exec 0</dev/null
524 exec 2>&1
525 set -x
--- 35 unchanged lines hidden ---