source: MondoRescue/branches/3.0/mondo/test/test-mr_stresc.c@ 3171

Last change on this file since 3171 was 3171, checked in by Bruno Cornec, 11 years ago
  • Fix #673 by improving single quote management in mr_stresc, and using single call for getfacl/getfattr and adding tests to test suite.
  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1/*
2 * $Id$
3 *
4 * Test program for mr_stresc
5 * Can be used on host system with valgrind easier than with mondorestore
6 */
7#include <stdio.h>
8#include <stdlib.h>
9#include "mr_str.h"
10#include "mr_mem.h"
11#include "my-stuff.h"
12
13/* Whether we should fail immediately at first error */
14bool g_fail_immediately = FALSE;
15
16void (*mr_cleanup)(void) = NULL;
17
18char *strl[] = {
19 "test with space",
20 "test with \\ backslash",
21 "test with \" doublequote",
22 "test with ' simplequote",
23 "test with ~ tilde",
24 "test with ? questionmark",
25 "test with ! exclammark",
26 "test with & ampersand",
27 "test with * star",
28 "test with | pipe",
29 "test with \\' backslash quote",
30 "test with nothing SPECIAL 1234",
31 "test with rtmp:_ retrieval with rtmpdump and tcpdump « Pxnh's Blog_files",
32 NULL
33};
34
35int main() {
36
37 char *p;
38 int i;
39
40 for (i = 1; strl[i] != NULL ; i++) {
41 printf("Test %2d Original chain is %s\n",i,strl[i]);
42 p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\', '"');
43 printf("Test %2d Transformed chain (with \") is %s\n",i,p);
44 mr_free(p);
45 p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\', '\'');
46 printf("Test %2d Transformed chain (with ') is %s\n",i,p);
47 mr_free(p);
48 }
49exit(0);
50}
Note: See TracBrowser for help on using the repository browser.