diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-13 10:21:43 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-13 10:33:34 +0300 |
commit | de3fbe3e8d4dd2a89f7755906d76055784c437cc (patch) | |
tree | 65356dd7b5a9010499550c468e960c93515a7e15 /tests | |
parent | f569a6f2628b9ddef4dfb4424aff2dad644a8f19 (diff) | |
download | wydawca-de3fbe3e8d4dd2a89f7755906d76055784c437cc.tar.gz wydawca-de3fbe3e8d4dd2a89f7755906d76055784c437cc.tar.bz2 |
Drop gnulib.
* bootstrap: Rewrite.
* bootstrap.conf: Remove.
* configure.ac: Remove gl_EARLY/gl_INIT
* src/backup.c: New file.
* src/txtacc.c (txtacc_finish): Make sure a new entry is
appended only once to the list.
* (all sources): Use grecs memory allocation functions.
* src/wydawca.h" Include fnmatch.h and regex.h
(backup_type): New enum.
(simple_backup_suffix): New extern.
(find_backup_file_name): New proto.
* tests/bkupname.c: New file.
* tests/backup00.at: New file.
* tests/backup01.at: New file.
* tests/backup02.at: New file.
* tests/backup03.at: New file.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Add new tests.
* grecs: Update.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 14 | ||||
-rw-r--r-- | tests/backup01.at | 33 | ||||
-rw-r--r-- | tests/backup02.at | 43 | ||||
-rw-r--r-- | tests/backup03.at | 41 | ||||
-rw-r--r-- | tests/bkupname.c | 79 | ||||
-rw-r--r-- | tests/testsuite.at | 4 |
7 files changed, 211 insertions, 4 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 7c8bd6b..1df6b71 100644 --- a/tests/.gitignore +++ b/tests/.gitignore | |||
@@ -9,3 +9,4 @@ dest | |||
9 | wstest | 9 | wstest |
10 | wsbatch | 10 | wsbatch |
11 | pushck | 11 | pushck |
12 | bkupname | ||
diff --git a/tests/Makefile.am b/tests/Makefile.am index b174fcd..cc52dbf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am | |||
@@ -24,7 +24,7 @@ SUBDIRS = etc | |||
24 | ## ------------ ## | 24 | ## ------------ ## |
25 | 25 | ||
26 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac | 26 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac |
27 | { \ | 27 | $(AM_V_GEN){ \ |
28 | echo '# Signature of the current package.'; \ | 28 | echo '# Signature of the current package.'; \ |
29 | echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ | 29 | echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ |
30 | echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ | 30 | echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ |
@@ -40,6 +40,10 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac | |||
40 | ## ------------ ## | 40 | ## ------------ ## |
41 | 41 | ||
42 | TESTSUITE_AT = \ | 42 | TESTSUITE_AT = \ |
43 | backup00.at\ | ||
44 | backup01.at\ | ||
45 | backup02.at\ | ||
46 | backup03.at\ | ||
43 | check-fail.at\ | 47 | check-fail.at\ |
44 | check-notify.at\ | 48 | check-notify.at\ |
45 | check-ok.at\ | 49 | check-ok.at\ |
@@ -73,9 +77,11 @@ check-local: atconfig atlocal $(TESTSUITE) | |||
73 | #installcheck-local: | 77 | #installcheck-local: |
74 | # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin | 78 | # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin |
75 | 79 | ||
76 | check_PROGRAMS = wstest wsbatch pushck | 80 | check_PROGRAMS = wstest wsbatch pushck bkupname |
77 | INCLUDES = -I$(top_srcdir)/grecs/src -I$(top_srcdir)/gnu -I../gnu -I$(top_srcdir)/src | 81 | INCLUDES = -I$(top_srcdir)/grecs/src -I$(top_srcdir)/src |
78 | LDADD=../grecs/src/libgrecs.a ../gnu/libgnu.a | 82 | LDADD=../grecs/src/libgrecs.a |
79 | 83 | ||
80 | pushck_LDADD=../src/pushd.o | 84 | pushck_LDADD=../src/pushd.o |
85 | bkupname_LDADD=../src/backup.o ../grecs/src/libgrecs.a | ||
86 | |||
81 | 87 | ||
diff --git a/tests/backup01.at b/tests/backup01.at new file mode 100644 index 0000000..7cf4f93 --- /dev/null +++ b/tests/backup01.at | |||
@@ -0,0 +1,33 @@ | |||
1 | # This file is part of wydawca testsuite -*- Autotest -*- | ||
2 | # Copyright (C) 2009, 2010 Sergey Poznyakoff | ||
3 | # | ||
4 | # Wydawca is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Wydawca is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with Wydawca. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP(simple backups) | ||
18 | AT_KEYWORDS([backup backup01 simple_backups]) | ||
19 | |||
20 | AT_CHECK([bkupname -simple a], | ||
21 | [0], | ||
22 | [a~ | ||
23 | ]) | ||
24 | |||
25 | AT_CHECK([ | ||
26 | touch a | ||
27 | bkupname -simple a | ||
28 | ], | ||
29 | [0], | ||
30 | [a~ | ||
31 | ]) | ||
32 | |||
33 | AT_CLEANUP | ||
diff --git a/tests/backup02.at b/tests/backup02.at new file mode 100644 index 0000000..b5bcc54 --- /dev/null +++ b/tests/backup02.at | |||
@@ -0,0 +1,43 @@ | |||
1 | # This file is part of wydawca testsuite -*- Autotest -*- | ||
2 | # Copyright (C) 2009, 2010 Sergey Poznyakoff | ||
3 | # | ||
4 | # Wydawca is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Wydawca is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with Wydawca. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP(numbered backups) | ||
18 | AT_KEYWORDS([backup backup02 numbered_backups]) | ||
19 | |||
20 | AT_CHECK([bkupname -numbered a], | ||
21 | [0], | ||
22 | [a.~1~ | ||
23 | ]) | ||
24 | |||
25 | AT_CHECK([ | ||
26 | touch a.~1~ | ||
27 | bkupname -numbered a | ||
28 | ], | ||
29 | [0], | ||
30 | [a.~2~ | ||
31 | ]) | ||
32 | |||
33 | AT_CHECK([ | ||
34 | touch a.~99~ | ||
35 | bkupname -numbered a | ||
36 | ], | ||
37 | [0], | ||
38 | [a.~100~ | ||
39 | ]) | ||
40 | |||
41 | |||
42 | |||
43 | AT_CLEANUP | ||
diff --git a/tests/backup03.at b/tests/backup03.at new file mode 100644 index 0000000..947c145 --- /dev/null +++ b/tests/backup03.at | |||
@@ -0,0 +1,41 @@ | |||
1 | # This file is part of wydawca testsuite -*- Autotest -*- | ||
2 | # Copyright (C) 2009, 2010 Sergey Poznyakoff | ||
3 | # | ||
4 | # Wydawca is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Wydawca is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with Wydawca. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP(numbered existing backups) | ||
18 | AT_KEYWORDS([backup backup03 numbered_existing_backups]) | ||
19 | |||
20 | AT_CHECK([bkupname -existing a], | ||
21 | [0], | ||
22 | [a~ | ||
23 | ]) | ||
24 | |||
25 | AT_CHECK([ | ||
26 | touch a.~1~ | ||
27 | bkupname -existing a | ||
28 | ], | ||
29 | [0], | ||
30 | [a.~2~ | ||
31 | ]) | ||
32 | |||
33 | AT_CHECK([ | ||
34 | touch a.~99~ | ||
35 | bkupname -existing a | ||
36 | ], | ||
37 | [0], | ||
38 | [a.~100~ | ||
39 | ]) | ||
40 | |||
41 | AT_CLEANUP | ||
diff --git a/tests/bkupname.c b/tests/bkupname.c new file mode 100644 index 0000000..6187146 --- /dev/null +++ b/tests/bkupname.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* wordsplit - a word splitter | ||
2 | Copyright (C) 2009, 2010 Sergey Poznyakoff | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU General Public License as published by the | ||
6 | Free Software Foundation; either version 3 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | #include "wydawca.h" | ||
19 | |||
20 | char *progname; | ||
21 | |||
22 | void | ||
23 | usage (int code) | ||
24 | { | ||
25 | FILE *fp = code ? stderr : stdout; | ||
26 | |||
27 | fprintf (fp, "usage: %s [-no] [-simple] [-existing] [-numbered] [-suffix=S] FILE\n", | ||
28 | progname); | ||
29 | exit (code); | ||
30 | } | ||
31 | |||
32 | int | ||
33 | main (int argc, char **argv) | ||
34 | { | ||
35 | enum backup_type type = numbered_backups; | ||
36 | char *file = NULL; | ||
37 | char *backup; | ||
38 | |||
39 | progname = argv[0]; | ||
40 | while (--argc) | ||
41 | { | ||
42 | char *arg = *++argv; | ||
43 | if (strcmp (arg, "-no") == 0) | ||
44 | type = no_backups; | ||
45 | else if (strcmp (arg, "-simple") == 0) | ||
46 | type = simple_backups; | ||
47 | else if (strcmp (arg, "-existing") == 0) | ||
48 | type = numbered_existing_backups; | ||
49 | else if (strcmp (arg, "-numbered") == 0) | ||
50 | type = numbered_backups; | ||
51 | else if (strncmp (arg, "-suffix=", 8) == 0) | ||
52 | simple_backup_suffix = arg + 8; | ||
53 | else if (arg[0] == '-') | ||
54 | usage (2); | ||
55 | else | ||
56 | { | ||