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

Last change on this file since 3170 was 3170, checked in by Bruno Cornec, 11 years ago
  • Extend tests on mr_stresc in order to solve #673
  • Property svn:eol-style set to native
File size: 1.0 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 "my-stuff.h"
11
12/* Whether we should fail immediately at first error */
13bool g_fail_immediately = FALSE;
14
15void (*mr_cleanup)(void) = NULL;
16
17char *strl[] = {
18 "test with space",
19 "test with \\ backslash",
20 "test with \" doublequote",
21 "test with ' simplequote",
22 "test with ~ tilde",
23 "test with ? questionmark",
24 "test with ! exclammark",
25 "test with & ampersand",
26 "test with * star",
27 "test with | pipe",
28 "test with \\' backslash quote",
29 "test with nothing SPECIAL 1234",
30 "test with rtmp:_ retrieval with rtmpdump and tcpdump « Pxnh's Blog_files",
31 NULL
32};
33
34int main() {
35
36 char *p;
37 int i;
38
39 for (i = 1; strl[i] != NULL ; i++) {
40 printf("Test %2d Original chain is %s\n",i,strl[i]);
41 p = mr_stresc(strl[i], "`$\\\"(){}'[]&*?|!#~", '\\');
42 printf("Test %2d Transformed chain is %s\n",i,p);
43 }
44exit(0);
45}
Note: See TracBrowser for help on using the repository browser.