aqhome: make delimiter a function argument instead of hardcoding "/".
This commit is contained in:
@@ -33,6 +33,7 @@ struct PATH_TEST_ENTRY {
|
||||
static int GWENHYWFAR_CB test1(GWEN_TEST_MODULE *mod);
|
||||
static int GWENHYWFAR_CB test2(GWEN_TEST_MODULE *mod);
|
||||
static int GWENHYWFAR_CB test3(GWEN_TEST_MODULE *mod);
|
||||
static int GWENHYWFAR_CB test4(GWEN_TEST_MODULE *mod);
|
||||
|
||||
|
||||
static void *_cbTestElement(const char *element, void *data, int idx, uint32_t flags);
|
||||
@@ -53,6 +54,7 @@ int AQH_Path_AddTests(GWEN_TEST_MODULE *mod)
|
||||
GWEN_Test_Module_AddTest(newMod, "test 1: path with index", test1, NULL);
|
||||
GWEN_Test_Module_AddTest(newMod, "test 2: path without index", test2, NULL);
|
||||
GWEN_Test_Module_AddTest(newMod, "test 3: path with backspace escape", test3, NULL);
|
||||
GWEN_Test_Module_AddTest(newMod, "test 4: path with index and different delimiter", test4, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -69,7 +71,7 @@ int test1(GWEN_UNUSED GWEN_TEST_MODULE *mod)
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
if (AQH_Path_Handle(path, expected, AQH_PATH_FLAGS_PARSEIDX, _cbTestElement)==NULL) {
|
||||
if (AQH_Path_Handle(path, expected, AQH_PATH_FLAGS_PARSEIDX, "/", _cbTestElement)==NULL) {
|
||||
DBG_ERROR(NULL, "Error handling patch \"%s\"", path);
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
@@ -89,7 +91,7 @@ int test2(GWEN_UNUSED GWEN_TEST_MODULE *mod)
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
if (AQH_Path_Handle(path, expected, 0, _cbTestElement)==NULL) {
|
||||
if (AQH_Path_Handle(path, expected, 0, "/", _cbTestElement)==NULL) {
|
||||
DBG_ERROR(NULL, "Error handling patch \"%s\"", path);
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
@@ -109,7 +111,27 @@ int test3(GWEN_UNUSED GWEN_TEST_MODULE *mod)
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
if (AQH_Path_Handle(path, expected, AQH_PATH_FLAGS_PARSEIDX, _cbTestElement)==NULL) {
|
||||
if (AQH_Path_Handle(path, expected, AQH_PATH_FLAGS_PARSEIDX, "/", _cbTestElement)==NULL) {
|
||||
DBG_ERROR(NULL, "Error handling patch \"%s\"", path);
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int test4(GWEN_UNUSED GWEN_TEST_MODULE *mod)
|
||||
{
|
||||
static char path[]="test1:test2[3]:test3[2]";
|
||||
static PATH_TEST_ENTRY expected[]={
|
||||
{"test1", 0, AQH_PATH_FLAGS_PARSEIDX},
|
||||
{"test2", 3, AQH_PATH_FLAGS_PARSEIDX},
|
||||
{"test3", 2, AQH_PATH_FLAGS_PARSEIDX | AQH_PATH_FLAGS_LAST},
|
||||
{NULL, 0, 0}
|
||||
};
|
||||
|
||||
if (AQH_Path_Handle(path, expected, AQH_PATH_FLAGS_PARSEIDX, ":", _cbTestElement)==NULL) {
|
||||
DBG_ERROR(NULL, "Error handling patch \"%s\"", path);
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user