Commit 2905effa authored by Geoff Simmons's avatar Geoff Simmons

implement and test formatters for %m

parent b418d66d
......@@ -294,10 +294,10 @@ format_I_backend(tx_t *tx, char *name, enum VSL_tag_e tag, char **s,
*len = strlen(*s);
}
#if 0
FORMAT(client, m, ReqMethod)
FORMAT(backend, m, BereqMethod)
FORMAT(client, m, RxRequest)
FORMAT(backend, m, TxRequest)
#if 0
#define FORMAT_q(dir, xurl) \
static void \
......
......@@ -68,3 +68,6 @@ formatter_f format_h_backend;
formatter_f format_I_client;
formatter_f format_I_backend;
formatter_f format_m_client;
formatter_f format_m_backend;
......@@ -527,6 +527,34 @@ static const char
return NULL;
}
static const char
*test_format_m(void)
{
tx_t tx;
logline_t rec;
chunk_t chunk;
char *str;
size_t len;
printf("... testing format_m_*()\n");
init_tx_rec_chunk(&tx, &rec, &chunk);
MAN(chunk.data);
#define REQMETHOD_PAYLOAD "GET"
set_record_data(&rec, &chunk, REQMETHOD_PAYLOAD, SLT_ReqMethod);
format_m_client(&tx, NULL, SLT__Bogus, &str, &len);
MASSERT(strcmp(str, "GET") == 0);
MASSERT(len == 3);
rec.tag = SLT_BereqMethod;
format_m_backend(&tx, NULL, SLT__Bogus, &str, &len);
MASSERT(strcmp(str, "GET") == 0);
MASSERT(len == 3);
return NULL;
}
static const char
*all_tests(void)
{
......@@ -542,6 +570,7 @@ static const char
mu_run_test(test_format_H);
mu_run_test(test_format_h);
mu_run_test(test_format_I);
mu_run_test(test_format_m);
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment