| 1 |
/* No escape */ |
| 2 |
#define MESSAGE1 "@var1@" |
| 3 |
|
| 4 |
/* Escaped whole variable */ |
| 5 |
#define MESSAGE2 "\\@var1\\@" |
| 6 |
|
| 7 |
/* Replace pairs of escapes before '@' or '\@' with escape characters |
| 8 |
* (note we have to double number of pairs due to C string escaping) |
| 9 |
*/ |
| 10 |
#define MESSAGE3 "\\\\@var1@" |
| 11 |
|
| 12 |
/* Pairs of escapes and then an escaped variable */ |
| 13 |
#define MESSAGE4 "\\\\\@var1\@" |
| 14 |
|
| 15 |
/* We don't gobble \@ prefixing some text */ |
| 16 |
#define MESSAGE5 "\\\\@var1" |
| 17 |
|
| 18 |
/* Check escape character outside variables |
| 19 |
\ @ \@ */ |
| 20 |
#define MESSAGE6 "\\ @ \\\\@" |
| 21 |
|
| 22 |
/* Catch any edge cases */ |
| 23 |
|
| 24 |
/* no substitution - not a variable */ |
| 25 |
#define MESSAGE7 "@var1" |
| 26 |
|
| 27 |
/* Escaped variable followed by another variable */ |
| 28 |
#define MESSAGE8 "\\\\@var1@var2@" |
| 29 |
|
| 30 |
/* Variable followed by another variable */ |
| 31 |
#define MESSAGE9 "@var1@var2@" |
| 32 |
|
| 33 |
/* Variable followed by another variable and escaped */ |
| 34 |
#define MESSAGE10 "@var1@var2\\\\@" |
| 35 |
|
| 36 |
/* Lots of substitutions in a row*/ |
| 37 |
#define MESSAGE11 "@var1@@var2@@var3@@var4@" |
| 38 |
|
| 39 |
/* This should never happen in the real world, right? */ |
| 40 |
#define MESSAGE12 "@var1@var2\\\\@var3@var4\\\\@" |