nghttpx: Fix tests
This commit is contained in:
parent
39c0a71065
commit
e255468bdf
|
@ -76,82 +76,82 @@ void test_shrpx_config_parse_log_format(void) {
|
||||||
CU_ASSERT(SHRPX_LOGF_REMOTE_ADDR == res[0].type);
|
CU_ASSERT(SHRPX_LOGF_REMOTE_ADDR == res[0].type);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[1].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[1].type);
|
||||||
CU_ASSERT(0 == strcmp(" - $remote_user [", res[1].value.get()));
|
CU_ASSERT(" - $remote_user [" == res[1].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_TIME_LOCAL == res[2].type);
|
CU_ASSERT(SHRPX_LOGF_TIME_LOCAL == res[2].type);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[3].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[3].type);
|
||||||
CU_ASSERT(0 == strcmp("] \"", res[3].value.get()));
|
CU_ASSERT("] \"" == res[3].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_REQUEST == res[4].type);
|
CU_ASSERT(SHRPX_LOGF_REQUEST == res[4].type);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[5].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[5].type);
|
||||||
CU_ASSERT(0 == strcmp("\" ", res[5].value.get()));
|
CU_ASSERT("\" " == res[5].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_STATUS == res[6].type);
|
CU_ASSERT(SHRPX_LOGF_STATUS == res[6].type);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[7].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[7].type);
|
||||||
CU_ASSERT(0 == strcmp(" ", res[7].value.get()));
|
CU_ASSERT(" " == res[7].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_BODY_BYTES_SENT == res[8].type);
|
CU_ASSERT(SHRPX_LOGF_BODY_BYTES_SENT == res[8].type);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[9].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[9].type);
|
||||||
CU_ASSERT(0 == strcmp(" \"", res[9].value.get()));
|
CU_ASSERT(" \"" == res[9].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_HTTP == res[10].type);
|
CU_ASSERT(SHRPX_LOGF_HTTP == res[10].type);
|
||||||
CU_ASSERT(0 == strcmp("referer", res[10].value.get()));
|
CU_ASSERT("referer" == res[10].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[11].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[11].type);
|
||||||
CU_ASSERT(0 == strcmp("\" ", res[11].value.get()));
|
CU_ASSERT("\" " == res[11].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_AUTHORITY == res[12].type);
|
CU_ASSERT(SHRPX_LOGF_AUTHORITY == res[12].type);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[13].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[13].type);
|
||||||
CU_ASSERT(0 == strcmp(" \"", res[13].value.get()));
|
CU_ASSERT(" \"" == res[13].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_HTTP == res[14].type);
|
CU_ASSERT(SHRPX_LOGF_HTTP == res[14].type);
|
||||||
CU_ASSERT(0 == strcmp("user-agent", res[14].value.get()));
|
CU_ASSERT("user-agent" == res[14].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[15].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[15].type);
|
||||||
CU_ASSERT(0 == strcmp("\"", res[15].value.get()));
|
CU_ASSERT("\"" == res[15].value);
|
||||||
|
|
||||||
res = parse_log_format("$");
|
res = parse_log_format("$");
|
||||||
|
|
||||||
CU_ASSERT(1 == res.size());
|
CU_ASSERT(1 == res.size());
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
||||||
CU_ASSERT(0 == strcmp("$", res[0].value.get()));
|
CU_ASSERT("$" == res[0].value);
|
||||||
|
|
||||||
res = parse_log_format("${");
|
res = parse_log_format("${");
|
||||||
|
|
||||||
CU_ASSERT(1 == res.size());
|
CU_ASSERT(1 == res.size());
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
||||||
CU_ASSERT(0 == strcmp("${", res[0].value.get()));
|
CU_ASSERT("${" == res[0].value);
|
||||||
|
|
||||||
res = parse_log_format("${a");
|
res = parse_log_format("${a");
|
||||||
|
|
||||||
CU_ASSERT(1 == res.size());
|
CU_ASSERT(1 == res.size());
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
||||||
CU_ASSERT(0 == strcmp("${a", res[0].value.get()));
|
CU_ASSERT("${a" == res[0].value);
|
||||||
|
|
||||||
res = parse_log_format("${a ");
|
res = parse_log_format("${a ");
|
||||||
|
|
||||||
CU_ASSERT(1 == res.size());
|
CU_ASSERT(1 == res.size());
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
||||||
CU_ASSERT(0 == strcmp("${a ", res[0].value.get()));
|
CU_ASSERT("${a " == res[0].value);
|
||||||
|
|
||||||
res = parse_log_format("$$remote_addr");
|
res = parse_log_format("$$remote_addr");
|
||||||
|
|
||||||
CU_ASSERT(2 == res.size());
|
CU_ASSERT(2 == res.size());
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
|
||||||
CU_ASSERT(0 == strcmp("$", res[0].value.get()));
|
CU_ASSERT("$" == res[0].value);
|
||||||
|
|
||||||
CU_ASSERT(SHRPX_LOGF_REMOTE_ADDR == res[1].type);
|
CU_ASSERT(SHRPX_LOGF_REMOTE_ADDR == res[1].type);
|
||||||
CU_ASSERT(nullptr == res[1].value.get());
|
CU_ASSERT(nullptr == res[1].value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_shrpx_config_read_tls_ticket_key_file(void) {
|
void test_shrpx_config_read_tls_ticket_key_file(void) {
|
||||||
|
|
Loading…
Reference in New Issue