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. 8a64478e8d953ed249ecd18


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. 8a64478e8d953ed249ecd18a8ec7fb19f69c167c
Date: Thu, 10 Jan 2013 18:12:16 +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  8a64478e8d953ed249ecd18a8ec7fb19f69c167c (commit)
      from  81df0ef6c9ae780d1b4a9f784a611e9c8a07789f (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=8a64478e8d953ed249ecd18a8ec7fb19f69c167c

commit 8a64478e8d953ed249ecd18a8ec7fb19f69c167c
Author: Andrew J. Schorr <address@hidden>
Date:   Thu Jan 10 13:12:01 2013 -0500

    Add tests for inplace extension.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 7fea3bf..33fb645 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-10         Andrew J. Schorr     <address@hidden>
+
+       * inplace.c (do_inplace_begin): No need to get the 2nd suffix argument,
+       since it is not currently used in this function.
+
 2013-01-08         Andrew J. Schorr     <address@hidden>
 
        * inplace.c: New extension to implement in-place editing.
diff --git a/extension/inplace.c b/extension/inplace.c
index 69b188b..31f21b6 100644
--- a/extension/inplace.c
+++ b/extension/inplace.c
@@ -93,7 +93,7 @@ invalid_filename(const awk_string_t *filename)
 static awk_value_t *
 do_inplace_begin(int nargs, awk_value_t *result)
 {
-       awk_value_t filename, suffix;
+       awk_value_t filename;
        struct stat sbuf;
        char *p;
        int fd;
@@ -109,8 +109,10 @@ do_inplace_begin(int nargs, awk_value_t *result)
        if (! get_argument(0, AWK_STRING, &filename))
                fatal(ext_id, _("inplace_begin: cannot retrieve 1st argument as 
a string filename"));
 
-       if (! get_argument(1, AWK_STRING, &suffix))
-               suffix.str_value.str = NULL;
+       /*
+        * N.B. In the current implementation, the 2nd suffix arg is not used
+        * in this function.  It is used only in the inplace_end function.
+        */
 
        if (invalid_filename(&filename.str_value)) {
                warning(ext_id, _("inplace_begin: disabling in-place editing 
for invalid FILENAME `%s'"),
diff --git a/test/ChangeLog b/test/ChangeLog
index b9a29c1..914a0fd 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,13 @@
+2013-01-10         Andrew J. Schorr     <address@hidden>
+
+       * inplace.1.in, inplace.2.in, inplace.in, inplace1.1.ok, inplace1.2.ok,
+       inplace1.ok, inplace2.1.bak.ok, inplace2.1.ok, inplace2.2.bak.ok,
+       inplace2.2.ok, inplace2.ok, inplace3.1.bak.ok, inplace3.1.ok,
+       inplace3.2.bak.ok, inplace3.2.ok, inplace3.ok: New files.
+       * Makefile.am (EXTRA_DIST): Add new files.
+       (SHLIB_TESTS): Add inplace1, inplace2, and inplace3.
+       (inplace1, inplace2, inplace3): New tests.
+
 2012-12-25         Arnold D. Robbins     <address@hidden>
 
        * assignconst.awk, assignconst.ok: Removed.
diff --git a/test/Makefile.am b/test/Makefile.am
index da67b05..7a541f9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -403,6 +403,22 @@ EXTRA_DIST = \
        indirectcall.ok \
        inftest.awk \
        inftest.ok \
+       inplace.in \
+       inplace.1.in \
+       inplace.2.in \
+       inplace1.ok \
+       inplace1.1.ok \
+       inplace1.2.ok \
+       inplace2.ok \
+       inplace2.1.ok \
+       inplace2.1.bak.ok \
+       inplace2.2.ok \
+       inplace2.2.bak.ok \
+       inplace3.ok \
+       inplace3.1.ok \
+       inplace3.1.bak.ok \
+       inplace3.2.ok \
+       inplace3.2.bak.ok \
        inputred.awk \
        inputred.ok \
        intest.awk \
@@ -953,8 +969,8 @@ LOCALE_CHARSET_TESTS = \
        mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
 SHLIB_TESTS = \
-       fnmatch filefuncs fork fork2 fts ordchr ordchr2 \
-       readdir readfile revout revtwoway rwarray testext time
+       fnmatch filefuncs fork fork2 fts inplace1 inplace2 inplace3 \
+       ordchr ordchr2 readdir readfile revout revtwoway rwarray testext time
 
 # List of the tests which should be run with --lint option:
 NEED_LINT = \
@@ -1675,6 +1691,38 @@ incdupe7::
        @AWKPATH=$(srcdir) $(AWK) --lint -f hello -i inchello >_$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+inplace1::
+       @echo $@
+       @cp $(srcdir)/inplace.1.in address@hidden
+       @cp $(srcdir)/inplace.2.in address@hidden
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace 'BEGIN {print 
"before"} {gsub(/foo/, "bar"); print} END {print "after"}' address@hidden - 
address@hidden < $(srcdir)/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+
+inplace2::
+       @echo $@
+       @cp $(srcdir)/inplace.1.in address@hidden
+       @cp $(srcdir)/inplace.2.in address@hidden
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace -v 
INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END 
{print "after"}' address@hidden - address@hidden < $(srcdir)/inplace.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+
+inplace3::
+       @echo $@
+       @cp $(srcdir)/inplace.1.in address@hidden
+       @cp $(srcdir)/inplace.2.in address@hidden
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace -v 
INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END 
{print "after"}' address@hidden - address@hidden < $(srcdir)/inplace.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace -v 
INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END 
{print "After"}' address@hidden - address@hidden < $(srcdir)/inplace.in >>_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+
 testext::
        @echo $@
        @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > 
testext.awk
diff --git a/test/Makefile.in b/test/Makefile.in
index e4b22fd..52d8edc 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -615,6 +615,22 @@ EXTRA_DIST = \
        indirectcall.ok \
        inftest.awk \
        inftest.ok \
+       inplace.in \
+       inplace.1.in \
+       inplace.2.in \
+       inplace1.ok \
+       inplace1.1.ok \
+       inplace1.2.ok \
+       inplace2.ok \
+       inplace2.1.ok \
+       inplace2.1.bak.ok \
+       inplace2.2.ok \
+       inplace2.2.bak.ok \
+       inplace3.ok \
+       inplace3.1.ok \
+       inplace3.1.bak.ok \
+       inplace3.2.ok \
+       inplace3.2.bak.ok \
        inputred.awk \
        inputred.ok \
        intest.awk \
@@ -1160,8 +1176,8 @@ LOCALE_CHARSET_TESTS = \
        mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
 
 SHLIB_TESTS = \
-       fnmatch filefuncs fork fork2 fts ordchr ordchr2 \
-       readdir readfile revout revtwoway rwarray testext time
+       fnmatch filefuncs fork fork2 fts inplace1 inplace2 inplace3 \
+       ordchr ordchr2 readdir readfile revout revtwoway rwarray testext time
 
 
 # List of the tests which should be run with --lint option:
@@ -2056,6 +2072,38 @@ incdupe7::
        @AWKPATH=$(srcdir) $(AWK) --lint -f hello -i inchello >_$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+inplace1::
+       @echo $@
+       @cp $(srcdir)/inplace.1.in address@hidden
+       @cp $(srcdir)/inplace.2.in address@hidden
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace 'BEGIN {print 
"before"} {gsub(/foo/, "bar"); print} END {print "after"}' address@hidden - 
address@hidden < $(srcdir)/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+
+inplace2::
+       @echo $@
+       @cp $(srcdir)/inplace.1.in address@hidden
+       @cp $(srcdir)/inplace.2.in address@hidden
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace -v 
INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END 
{print "after"}' address@hidden - address@hidden < $(srcdir)/inplace.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+
+inplace3::
+       @echo $@
+       @cp $(srcdir)/inplace.1.in address@hidden
+       @cp $(srcdir)/inplace.2.in address@hidden
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace -v 
INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END 
{print "after"}' address@hidden - address@hidden < $(srcdir)/inplace.in >_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @AWKPATH=$(srcdir)/../awklib/eg/lib $(AWK) -i inplace -v 
INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END 
{print "After"}' address@hidden - address@hidden < $(srcdir)/inplace.in >>_$@ 
2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+       @-$(CMP) $(srcdir)/address@hidden address@hidden && rm -f address@hidden
+
 testext::
        @echo $@
        @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > 
testext.awk
diff --git a/test/inplace.1.in b/test/inplace.1.in
new file mode 100644
index 0000000..d87f79a
--- /dev/null
+++ b/test/inplace.1.in
@@ -0,0 +1,2 @@
+is foo replaced?
+and again foo here?
diff --git a/test/inplace.2.in b/test/inplace.2.in
new file mode 100644
index 0000000..4644a91
--- /dev/null
+++ b/test/inplace.2.in
@@ -0,0 +1,2 @@
+another input file containing foo and foo and more foo
+but nothing to replace here
diff --git a/test/inplace.in b/test/inplace.in
new file mode 100644
index 0000000..bf2cf98
--- /dev/null
+++ b/test/inplace.in
@@ -0,0 +1,3 @@
+stdin start
+is foo replaced?
+stdin end
diff --git a/test/inplace1.1.ok b/test/inplace1.1.ok
new file mode 100644
index 0000000..8faa542
--- /dev/null
+++ b/test/inplace1.1.ok
@@ -0,0 +1,2 @@
+is bar replaced?
+and again bar here?
diff --git a/test/inplace1.2.ok b/test/inplace1.2.ok
new file mode 100644
index 0000000..64427be
--- /dev/null
+++ b/test/inplace1.2.ok
@@ -0,0 +1,2 @@
+another input file containing bar and bar and more bar
+but nothing to replace here
diff --git a/test/inplace1.ok b/test/inplace1.ok
new file mode 100644
index 0000000..ffcb768
--- /dev/null
+++ b/test/inplace1.ok
@@ -0,0 +1,6 @@
+before
+gawk: inplace:9: warning: inplace_begin: disabling in-place editing for 
invalid FILENAME `-'
+stdin start
+is bar replaced?
+stdin end
+after
diff --git a/test/inplace2.1.bak.ok b/test/inplace2.1.bak.ok
new file mode 100644
index 0000000..d87f79a
--- /dev/null
+++ b/test/inplace2.1.bak.ok
@@ -0,0 +1,2 @@
+is foo replaced?
+and again foo here?
diff --git a/test/inplace2.1.ok b/test/inplace2.1.ok
new file mode 100644
index 0000000..8faa542
--- /dev/null
+++ b/test/inplace2.1.ok
@@ -0,0 +1,2 @@
+is bar replaced?
+and again bar here?
diff --git a/test/inplace2.2.bak.ok b/test/inplace2.2.bak.ok
new file mode 100644
index 0000000..4644a91
--- /dev/null
+++ b/test/inplace2.2.bak.ok
@@ -0,0 +1,2 @@
+another input file containing foo and foo and more foo
+but nothing to replace here
diff --git a/test/inplace2.2.ok b/test/inplace2.2.ok
new file mode 100644
index 0000000..64427be
--- /dev/null
+++ b/test/inplace2.2.ok
@@ -0,0 +1,2 @@
+another input file containing bar and bar and more bar
+but nothing to replace here
diff --git a/test/inplace2.ok b/test/inplace2.ok
new file mode 100644
index 0000000..ffcb768
--- /dev/null
+++ b/test/inplace2.ok
@@ -0,0 +1,6 @@
+before
+gawk: inplace:9: warning: inplace_begin: disabling in-place editing for 
invalid FILENAME `-'
+stdin start
+is bar replaced?
+stdin end
+after
diff --git a/test/inplace3.1.bak.ok b/test/inplace3.1.bak.ok
new file mode 100644
index 0000000..8faa542
--- /dev/null
+++ b/test/inplace3.1.bak.ok
@@ -0,0 +1,2 @@
+is bar replaced?
+and again bar here?
diff --git a/test/inplace3.1.ok b/test/inplace3.1.ok
new file mode 100644
index 0000000..d87f79a
--- /dev/null
+++ b/test/inplace3.1.ok
@@ -0,0 +1,2 @@
+is foo replaced?
+and again foo here?
diff --git a/test/inplace3.2.bak.ok b/test/inplace3.2.bak.ok
new file mode 100644
index 0000000..64427be
--- /dev/null
+++ b/test/inplace3.2.bak.ok
@@ -0,0 +1,2 @@
+another input file containing bar and bar and more bar
+but nothing to replace here
diff --git a/test/inplace3.2.ok b/test/inplace3.2.ok
new file mode 100644
index 0000000..4644a91
--- /dev/null
+++ b/test/inplace3.2.ok
@@ -0,0 +1,2 @@
+another input file containing foo and foo and more foo
+but nothing to replace here
diff --git a/test/inplace3.ok b/test/inplace3.ok
new file mode 100644
index 0000000..7cd960b
--- /dev/null
+++ b/test/inplace3.ok
@@ -0,0 +1,12 @@
+before
+gawk: inplace:9: warning: inplace_begin: disabling in-place editing for 
invalid FILENAME `-'
+stdin start
+is bar replaced?
+stdin end
+after
+Before
+gawk: inplace:9: warning: inplace_begin: disabling in-place editing for 
invalid FILENAME `-'
+stdin start
+is foo replaced?
+stdin end
+After

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

Summary of changes:
 extension/ChangeLog    |    5 ++++
 extension/inplace.c    |    8 ++++--
 test/ChangeLog         |   10 +++++++++
 test/Makefile.am       |   52 ++++++++++++++++++++++++++++++++++++++++++++++-
 test/Makefile.in       |   52 ++++++++++++++++++++++++++++++++++++++++++++++-
 test/inplace.1.in      |    2 +
 test/inplace.2.in      |    2 +
 test/inplace.in        |    3 ++
 test/inplace1.1.ok     |    2 +
 test/inplace1.2.ok     |    2 +
 test/inplace1.ok       |    6 +++++
 test/inplace2.1.bak.ok |    2 +
 test/inplace2.1.ok     |    2 +
 test/inplace2.2.bak.ok |    2 +
 test/inplace2.2.ok     |    2 +
 test/inplace2.ok       |    6 +++++
 test/inplace3.1.bak.ok |    2 +
 test/inplace3.1.ok     |    2 +
 test/inplace3.2.bak.ok |    2 +
 test/inplace3.2.ok     |    2 +
 test/inplace3.ok       |   12 +++++++++++
 21 files changed, 171 insertions(+), 7 deletions(-)
 create mode 100644 test/inplace.1.in
 create mode 100644 test/inplace.2.in
 create mode 100644 test/inplace.in
 create mode 100644 test/inplace1.1.ok
 create mode 100644 test/inplace1.2.ok
 create mode 100644 test/inplace1.ok
 create mode 100644 test/inplace2.1.bak.ok
 create mode 100644 test/inplace2.1.ok
 create mode 100644 test/inplace2.2.bak.ok
 create mode 100644 test/inplace2.2.ok
 create mode 100644 test/inplace2.ok
 create mode 100644 test/inplace3.1.bak.ok
 create mode 100644 test/inplace3.1.ok
 create mode 100644 test/inplace3.2.bak.ok
 create mode 100644 test/inplace3.2.ok
 create mode 100644 test/inplace3.ok


hooks/post-receive
-- 
gawk



reply via email to

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