xref: /Universal-ctags/libreadtags/tests/test-api-tagsClose.c (revision a41b16516f3da7c2ee4d19b4240bc27562d4b442)
1 /*
2 *   Copyright (c) 2020, Masatake YAMATO
3 *
4 *   This source code is released into the public domain.
5 *
6 *   Testing tagsClose() API function for broken argument
7 */
8 
9 #include "readtags.h"
10 
11 #include <stdio.h>
12 #include <string.h>
13 #include <stdlib.h>
14 #include <unistd.h>
15 
16 int
main(void)17 main (void)
18 {
19 	char *srcdir = getenv ("srcdir");
20 	if (srcdir)
21 	{
22 		if (chdir (srcdir) == -1)
23 		{
24 			perror ("chdir");
25 			return 99;
26 		}
27 	}
28 
29 	fprintf (stderr, "closing NULL...");
30 	if (tagsClose (NULL) == TagSuccess)
31 	{
32 		fprintf (stderr, "successful unexpectedly\n");
33 		return 1;
34 	}
35 
36 	return 0;
37 }
38