aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-10 23:12:02 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-11 00:28:52 +0300
commitdb81e378576dcc5510032c72060e48e562f208c9 (patch)
tree914c5f277a5fad050527a5c5da815f521e8023dc /tests
parent84db86f0151385a8f05483bf691fde86b4e4e153 (diff)
downloadwydawca-db81e378576dcc5510032c72060e48e562f208c9.tar.gz
wydawca-db81e378576dcc5510032c72060e48e562f208c9.tar.bz2
Remove save-cwd.
* src/pushd.c: New file. * src/Makefile.am: Add pushd.c * src/wydawca.h (push_dir, pop_dir): New functions. * src/diskio.c: Use push_dir/pop_dir. * src/exec.c: Likewise. * src/gpg.c: Likewise. * gnulib.modules: Remove save-cwd. * tests/pushck.c: New file. * tests/pushdir.at: New file. * tests/testsuite.at: Add pushdir.at * tests/Makefile.am: Likewise. * tests/.gitignore: Add pushck.
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/pushck.c34
-rw-r--r--tests/pushdir.at39
-rw-r--r--tests/testsuite.at2
5 files changed, 81 insertions, 3 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 15381c3..7c8bd6b 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -8,3 +8,4 @@ source
dest
wstest
wsbatch
+pushck
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3da497b..b174fcd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -43,9 +43,10 @@ TESTSUITE_AT = \
check-fail.at\
check-notify.at\
check-ok.at\
- testsuite.at\
notify-upl.at\
mailstats.at\
+ pushdir.at\
+ testsuite.at\
upload.at\
upload-dry.at\
version.at\
@@ -72,8 +73,9 @@ check-local: atconfig atlocal $(TESTSUITE)
#installcheck-local:
# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
-check_PROGRAMS = wstest wsbatch
-INCLUDES = -I$(top_srcdir)/grecs/src -I$(top_srcdir)/gnu -I../gnu
+check_PROGRAMS = wstest wsbatch pushck
+INCLUDES = -I$(top_srcdir)/grecs/src -I$(top_srcdir)/gnu -I../gnu -I$(top_srcdir)/src
LDADD=../grecs/src/libgrecs.a ../gnu/libgnu.a
+pushck_LDADD=../src/pushd.o
diff --git a/tests/pushck.c b/tests/pushck.c
new file mode 100644
index 0000000..f94cbf7
--- /dev/null
+++ b/tests/pushck.c
@@ -0,0 +1,34 @@
+#include <config.h>
+#include <wydawca.h>
+
+static void
+printcwd (int c)
+{
+ char *dir = getcwd_alloc ();
+ printf ("%c%s\n", c, dir);
+ free (dir);
+}
+
+int
+main (int argc, char **argv)
+{
+ while (--argc)
+ {
+ char *dir = *++argv;
+ if (push_dir (dir))
+ {
+ perror (dir);
+ abort ();
+ }
+ printcwd ('+');
+ }
+
+ do
+ {
+ printcwd ('-');
+ }
+ while (pop_dir() == 0);
+ exit(0);
+}
+
+ /*===============*/
diff --git a/tests/pushdir.at b/tests/pushdir.at
new file mode 100644
index 0000000..3887ffb
--- /dev/null
+++ b/tests/pushdir.at
@@ -0,0 +1,39 @@
+# Check directory stack functions -*- Autotest -*-
+# Copyright (C) 2011 Sergey Poznyakoff
+#
+# Wydawca is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Wydawca is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([Directory push/pop])
+AT_KEYWORDS([dir pushdir])
+
+AT_CHECK([
+install-sh -d a/b/c/d/e >/dev/null || exit 1
+cwd=`pwd`
+pushck a b c d e | sed 's|'"$cwd"'||'
+],
+[0],
+[+/a
++/a/b
++/a/b/c
++/a/b/c/d
++/a/b/c/d/e
+-/a/b/c/d/e
+-/a/b/c/d
+-/a/b/c
+-/a/b
+-/a
+-
+])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 1adc6db..240ab5d 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -23,6 +23,8 @@ AT_INIT
AT_TESTED([wydawca])
m4_include([version.at])
m4_include([wordsplit.at])
+m4_include([pushdir.at])
+
m4_include([upload-dry.at])
m4_include([upload.at])
m4_include([notify-upl.at])

Return to:

Send suggestions and report system problems to the System administrator.