30 auto test = [] (std::string s,
const char *from,
const char *to,
33 char *temp = xstrdup (s.c_str ());
35 SELF_CHECK (strcmp (temp, expected) == 0);
39 test (
"/abc/$def/g",
"abc",
"xyz",
"/xyz/$def/g");
40 test (
"abc/$def/g",
"abc",
"xyz",
"xyz/$def/g");
41 test (
"/abc/$def/g",
"$def",
"xyz",
"/abc/xyz/g");
42 test (
"/abc/$def/g",
"g",
"xyz",
"/abc/$def/xyz");
43 test (
"/abc/$def/g",
"ab",
"xyz",
"/abc/$def/g");
44 test (
"/abc/$def/g",
"def",
"xyz",
"/abc/$def/g");
45 test (
"/abc/$def/g",
"abc",
"abc",
"/abc/$def/g");
46 test (
"/abc/$def/g",
"abc",
"",
"//$def/g");
47 test (
"/abc/$def/g",
"abc/$def",
"xyz",
"/xyz/g");
48 test (
"/abc/$def/abc",
"abc",
"xyz",
"/xyz/$def/xyz");