diff options
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 | |||
@@ -6,6 +6,7 @@ testsuite.dir | |||
6 | testsuite.log | 6 | testsuite.log |
7 | source | 7 | source |
8 | dest | 8 | 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 | |||
@@ -21,13 +21,13 @@ SUBDIRS = etc | |||
21 | 21 | ||
22 | ## ------------ ## | 22 | ## ------------ ## |
23 | ## package.m4. ## | 23 | ## package.m4. ## |
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@])'; \ |
31 | echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ | 31 | echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ |
32 | echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ | 32 | echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ |
33 | echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ | 33 | echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ |
@@ -37,12 +37,16 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac | |||
37 | 37 | ||
38 | ## ------------ ## | 38 | ## ------------ ## |
39 | ## Test suite. ## | 39 | ## Test suite. ## |
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\ |
46 | notify-upl.at\ | 50 | notify-upl.at\ |
47 | mailstats.at\ | 51 | mailstats.at\ |
48 | pushdir.at\ | 52 | pushdir.at\ |
@@ -70,12 +74,14 @@ check-local: atconfig atlocal $(TESTSUITE) | |||
70 | $(SHELL) $(TESTSUITE) | 74 | $(SHELL) $(TESTSUITE) |
71 | 75 | ||
72 | # Run the test suite on the *installed* tree. | 76 | # Run the test suite on the *installed* tree. |
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];< |