gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. 0a4c1c5344b5d6c17507086


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. 0a4c1c5344b5d6c1750708675901509210497761
Date: Wed, 30 Mar 2011 20:03:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  0a4c1c5344b5d6c1750708675901509210497761 (commit)
      from  86d89c929013e64bf4e4b28af2facd549c3bfaba (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0a4c1c5344b5d6c1750708675901509210497761

commit 0a4c1c5344b5d6c1750708675901509210497761
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Mar 30 22:02:26 2011 +0200

    Add tests for next and exit to test suite.

diff --git a/test/ChangeLog b/test/ChangeLog
index 7b3aa52..c429ce4 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+Wed Mar 30 22:00:59 2011  Arnold D. Robbins  <address@hidden>
+
+       * next.sh, exit.sh: New files from John Haque, edited somewhat.
+       * Makefile.am (next, exit): New tests.
+
 Mon Feb 21 20:32:36 2011  Arnold D. Robbins  <address@hidden>
 
        * Makefile.am (GAWK_EXT_TESTS): Include profile3. Thanks to
diff --git a/test/Makefile.am b/test/Makefile.am
index a63c15c..2fecaca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -172,6 +172,8 @@ EXTRA_DIST = \
        dynlj.ok \
        eofsplit.awk \
        eofsplit.ok \
+       exit.ok \
+       exit.sh \
        exitval1.awk \
        exitval1.ok \
        exitval2.awk \
@@ -414,6 +416,8 @@ EXTRA_DIST = \
        nested.awk \
        nested.in \
        nested.ok \
+       next.ok \
+       next.sh \
        nfldstr.awk \
        nfldstr.in \
        nfldstr.ok \
@@ -736,13 +740,15 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm 
arrayprm2 arrayprm3 \
        aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \
        closebad clsflnam compare compare2 concat1 concat2 concat3 concat4 \
        convfmt datanonl defref delarpm2 delarprm delfunc dynlj eofsplit \
+       exit \
        exitval1 exitval2 fcall_exit fcall_exit2 fldchg fldchgnf fnamedat \
        fnarray fnarray2 fnaryscl fnasgnm fnmisc fordel forref forsimp \
        fsbs fsrs fsspcoln fstabplus funsemnl funsmnam funstack getline \
        getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest gsubtst2 
\
        gsubtst3 gsubtst4 gsubtst5 gsubtst6 hex hsprint inputred intest intprec 
iobug1 \
        leaddig leadnl litoct longsub longwrds manglprm math membug1 messages \
-       minusstr mmap8k mtchi18n nasty nasty2 negexp negrange nested nfldstr 
nfneg \
+       minusstr mmap8k mtchi18n nasty nasty2 negexp negrange nested next \
+       nfldstr nfneg \
        nfset nlfldsep nlinstr nlstrina noeffect nofile nofmtch noloop1 \
        noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \
        ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramres \
@@ -1334,6 +1340,16 @@ profile3:
        @sed 1,2d < awkprof.out > _$@; rm awkprof.out
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+next:
+       @echo $@
+       @-AWK="$(AWKPROG)" $(srcdir)/address@hidden > _$@ 2>&1
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
+exit:
+       @echo $@
+       @-AWK="$(AWKPROG)" $(srcdir)/address@hidden > _$@ 2>&1
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
 # Targets generated for other tests:
 include Maketests
 
diff --git a/test/Makefile.in b/test/Makefile.in
index a6783c8..51bdf29 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -357,6 +357,8 @@ EXTRA_DIST = \
        dynlj.ok \
        eofsplit.awk \
        eofsplit.ok \
+       exit.ok \
+       exit.sh \
        exitval1.awk \
        exitval1.ok \
        exitval2.awk \
@@ -599,6 +601,8 @@ EXTRA_DIST = \
        nested.awk \
        nested.in \
        nested.ok \
+       next.ok \
+       next.sh \
        nfldstr.awk \
        nfldstr.in \
        nfldstr.ok \
@@ -921,13 +925,15 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm 
arrayprm2 arrayprm3 \
        aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \
        closebad clsflnam compare compare2 concat1 concat2 concat3 concat4 \
        convfmt datanonl defref delarpm2 delarprm delfunc dynlj eofsplit \
+       exit \
        exitval1 exitval2 fcall_exit fcall_exit2 fldchg fldchgnf fnamedat \
        fnarray fnarray2 fnaryscl fnasgnm fnmisc fordel forref forsimp \
        fsbs fsrs fsspcoln fstabplus funsemnl funsmnam funstack getline \
        getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest gsubtst2 
\
        gsubtst3 gsubtst4 gsubtst5 gsubtst6 hex hsprint inputred intest intprec 
iobug1 \
        leaddig leadnl litoct longsub longwrds manglprm math membug1 messages \
-       minusstr mmap8k mtchi18n nasty nasty2 negexp negrange nested nfldstr 
nfneg \
+       minusstr mmap8k mtchi18n nasty nasty2 negexp negrange nested next \
+       nfldstr nfneg \
        nfset nlfldsep nlinstr nlstrina noeffect nofile nofmtch noloop1 \
        noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \
        ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramres \
@@ -1682,6 +1688,16 @@ profile3:
        @$(PGAWK) -f $(srcdir)/address@hidden > /dev/null
        @sed 1,2d < awkprof.out > _$@; rm awkprof.out
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
+next:
+       @echo $@
+       @-AWK="$(AWKPROG)" $(srcdir)/address@hidden > _$@ 2>&1
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
+exit:
+       @echo $@
+       @-AWK="$(AWKPROG)" $(srcdir)/address@hidden > _$@ 2>&1
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 Gt-dummy:
 # file Maketests, generated from Makefile.am by the Gentests program
 addcomma:
diff --git a/test/exit.ok b/test/exit.ok
new file mode 100644
index 0000000..724b449
--- /dev/null
+++ b/test/exit.ok
@@ -0,0 +1,25 @@
+1
+3
+-- 1
+2
+-- 2
+2
+-- 3
+2
+2
+-- 4
+0
+-- 5
+1 null
+-- 6
+1 null
+-- 7
+0 exit.sh
+-- 8
+1
+0 exit.sh
+-- 9
+0 null
+-- 10
+1 null
+-- 11
diff --git a/test/exit.sh b/test/exit.sh
new file mode 100755
index 0000000..8106fbb
--- /dev/null
+++ b/test/exit.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# exit.sh --- text exit invoked in various ways
+
+if [ "$AWK" = "" ]
+then
+       echo $0: You must set AWK >&2
+       exit 1
+fi
+
+# Use awk to print the string instead of echo or printf.
+
+x='BEGIN{print 1; exit; print 2}; NR>1{print}; END{print 3; exit; print 4}'
+$AWK 'BEGIN { print "a\nb" }' | $AWK "$x"
+echo "-- 1"
+
+x='function f(){ exit}; END{print NR;f();print NR}'
+$AWK 'BEGIN { print "a\nb" }' | $AWK "$x"
+echo "-- 2"
+
+x='function f(){ exit}; NR>1 {f()}; END{print NR; f();print NR}'
+$AWK 'BEGIN { print "a\nb" }' | $AWK "$x"
+echo "-- 3"
+
+x='function f(){ exit}; NR>1{ f()}; END{print NR;print NR}'
+$AWK 'BEGIN { print "a\nb" }' | $AWK "$x"
+echo "-- 4"
+
+x='function f(){ exit}; BEGINFILE {f()}; NR>1{ f()}; END{print NR}'
+$AWK 'BEGIN { print "a\nb" }' | $AWK "$x"
+echo "-- 5"
+
+y='function strip(f) { sub(/.*\//, "", f); return f };'
+
+x='BEGINFILE{if(++i==1) exit;}; END{print i, strip(FILENAME)}'
+$AWK "$y$x" /dev/null $0
+echo "-- 6"
+
+x='BEGINFILE{if(++i==1) exit;}; ENDFILE{print i++}; END{print i, 
strip(FILENAME)}'
+$AWK "$y$x" /dev/null $0
+echo "-- 7"
+
+x='function f(){ exit}; BEGINFILE{i++ && f()}; END{print NR,strip(FILENAME)}'
+$AWK "$y$x" /dev/null $0
+echo "-- 8"
+
+x='function f(){ exit}; BEGINFILE{i++ && f()}; ENDFILE{ print i}; END{print 
NR,strip(FILENAME)}'
+$AWK "$y$x" /dev/null $0
+echo "-- 9"
+
+x='function f(){ exit}; BEGINFILE{i++}; ENDFILE{ f(); print i}; END{print 
NR,strip(FILENAME)}'
+$AWK "$y$x" /dev/null $0
+echo "-- 10"
+
+x='function f(){ exit}; BEGINFILE{i++}; ENDFILE{ i>1 && f(); print i, 
strip(FILENAME)}'
+$AWK "$y$x" /dev/null $0
+echo "-- 11"
diff --git a/test/next.ok b/test/next.ok
new file mode 100644
index 0000000..0229bd0
--- /dev/null
+++ b/test/next.ok
@@ -0,0 +1,4 @@
+gawk: cmd. line:1: fatal: `next' cannot be called from a `BEGIN' rule
+gawk: cmd. line:1: fatal: `next' cannot be called from a `END' rule
+gawk: cmd. line:1: fatal: `next' cannot be called from a `BEGINFILE' rule
+gawk: cmd. line:1: fatal: `next' cannot be called from a `ENDFILE' rule
diff --git a/test/next.sh b/test/next.sh
new file mode 100755
index 0000000..77354a2
--- /dev/null
+++ b/test/next.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# next.sh --- test next invoked in various ways
+
+if [ "$AWK" = "" ]
+then
+       echo $0: You must set AWK >&2
+       exit 1
+fi
+
+# non-fatal 
+$AWK '{next}' /dev/null
+$AWK 'function f() { next}; {f()}' /dev/null
+# fatal
+$AWK 'function f() { next}; BEGIN{f()}'
+$AWK 'function f() { next}; {f()}; END{f()}' /dev/null
+$AWK 'function f() { next}; BEGINFILE{f()}'
+$AWK 'function f() { next}; {f()}; ENDFILE{f()}' /dev/null
+
+exit 0 # for make

-----------------------------------------------------------------------

Summary of changes:
 test/ChangeLog   |    5 ++++
 test/Makefile.am |   18 ++++++++++++++++-
 test/Makefile.in |   18 ++++++++++++++++-
 test/exit.ok     |   25 +++++++++++++++++++++++
 test/exit.sh     |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/next.ok     |    4 +++
 test/next.sh     |   20 ++++++++++++++++++
 7 files changed, 145 insertions(+), 2 deletions(-)
 create mode 100644 test/exit.ok
 create mode 100755 test/exit.sh
 create mode 100644 test/next.ok
 create mode 100755 test/next.sh


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]