annotate tests/test-glob-h.c @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents c2e4326c3f66
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39777
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of <glob.h> substitute.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 39777
diff changeset
2 Copyright (C) 2009-2019 Free Software Foundation, Inc.
39777
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Simon Josefsson <simon@josefsson.org>, 2009. */
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <glob.h>
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include "macros.h"
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 /* Check that size_t is defined. */
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 size_t a;
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 /* Check that the various GLOB_* macros are defined. */
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 int flags[] =
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 {
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 GLOB_APPEND,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 GLOB_DOOFFS,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 GLOB_ERR,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 GLOB_MARK,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 GLOB_NOCHECK,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 GLOB_NOESCAPE,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 GLOB_NOSORT
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 };
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 int ret[] =
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 {
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 GLOB_ABORTED,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 GLOB_NOMATCH,
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 GLOB_NOSPACE
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 };
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 int
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 main ()
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 {
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 glob_t g;
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 /* Make sure glob_t struct members exists. */
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 ASSERT (sizeof (g.gl_pathc));
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 ASSERT (sizeof (g.gl_pathv));
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 ASSERT (sizeof (g.gl_offs));
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 return 0;
c2e4326c3f66 glob-h: Add tests.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 }