--- var_test.c 2001/11/13 13:33:28 1.5
+++ var_test.c 2001/11/13 14:36:55 1.6
@@ -3,7 +3,7 @@
#include <errno.h>
#include "var.h"
-int env_lookup(void* context,
+static int env_lookup(void* context,
const char* varname, size_t name_len,
const char** data, size_t* data_len, size_t* buffer_size)
{
@@ -81,12 +81,13 @@
{ "${FOO:p/15/../c}", "......os......." },
{ "${FOO:p/15/12345/c}", "123451os1234512" },
{ "${FOO:s/os/\\x{4F}\\123/g}", "OS" },
- { "${FOO:s/os/\\1\\x4F\\123/t}", "\\1OS" }
+ { "${FOO:s/os/\\1\\x4F\\123/t}", "\\1OS" },
+ { "${HOME:s/g(res)s/x\\1x/g}", "/home/rexresxion-tests" },
+ { "${HOME:s/(s+)/_\\1_/g}", "/home/regre_ss_ion-te_s_t_s_" },
+ { "${HOME:s/\\x65/\\x45/g}", "/homE/rEgrEssion-tEsts" },
+ { "${HOME:s/(s*)/x\\1X/g}", "xXxXxXxXxXxXxXxXxXxXxXxssXxXxXxXxXxXxXxsXxXxsX" },
+ { "${HOME:s/./\\\\/g}", "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" }
};
- /*
- { "${HOME:s/g(res)s/x\\\\1x/g}","/homE/rEgrEssion-tEsts" }
- { "${HOME:s/\\x65/\\x45/g}", "/home/regression-tests" }
- */
char* tmp;
size_t tmp_len;
var_rc_t rc;
@@ -135,15 +136,6 @@
printf("Test case #%d: Expected result '%s' but got '%s'.\n", i, tests[i].expected, tmp);
return 1;
}
- rc = var_unescape(tests[i].input, strlen(tests[i].input), buffer, 1);
- if (rc != VAR_OK)
- {
- printf("Test case #%d: Second var_unescape() failed with return code %d.\n", i, rc);
- return 1;
- }
-#ifdef DEBUG
- printf("Test case #%02d: Unescaped output is '%s'.\n\n", i, tmp);
-#endif
free(tmp);
}
|