2 Unix SMB/CIFS implementation.
6 Copyright (C) Jelmer Vernooij 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "torture/torture.h"
26 static const char *test_lists_shell_strings[] = {
36 static BOOL test_lists_shell(TALLOC_CTX *mem_ctx)
39 for (i = 0; test_lists_shell_strings[i]; i++) {
40 const char **ret1, **ret2, *tmp;
43 ret1 = str_list_make_shell(mem_ctx, test_lists_shell_strings[i], " ");
44 tmp = str_list_join_shell(mem_ctx, ret1, ' ');
45 ret2 = str_list_make_shell(mem_ctx, tmp, " ");
47 if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
51 for (j = 0; ret1[j] && ret2[j]; j++) {
52 if (strcmp(ret1[j], ret2[j]) != 0) {
58 if (ret1[j] || ret2[j])
63 printf("str_list_{make,join}_shell: Error double parsing, first run:\n%s\nSecond run: \n%s\n",
64 test_lists_shell_strings[i],
73 BOOL torture_local_util_strlist(struct torture_context *torture)
76 TALLOC_CTX *mem_ctx = talloc_init("test_util_strlist");
78 ret &= test_lists_shell(mem_ctx);