MCPcopy Create free account
hub / github.com/apache/trafficserver / test_processing

Function test_processing

plugins/header_rewrite/header_rewrite_test.cc:420–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420int
421test_processing()
422{
423 int errors = 0;
424 /*
425 * These tests are designed to verify that the processing of the parsed input is correct.
426 */
427 {
428 ParserTest p(R"(cond %{CLIENT-HEADER:non_existent_header} ="=" [AND])");
429
430 CHECK_EQ(p.getTokens().size(), 5UL);
431 CHECK_EQ(p.get_op(), "CLIENT-HEADER:non_existent_header");
432 CHECK_EQ(p.get_arg(), "==");
433 CHECK_EQ(p.is_cond(), true);
434
435 END_TEST();
436 }
437
438 {
439 ParserTest p(R"(cond %{CLIENT-HEADER:non_existent_header} = "shouldnt_ = _anyway" [AND])");
440
441 CHECK_EQ(p.getTokens().size(), 5UL);
442 CHECK_EQ(p.get_op(), "CLIENT-HEADER:non_existent_header");
443 CHECK_EQ(p.get_arg(), "=shouldnt_ = _anyway");
444 CHECK_EQ(p.is_cond(), true);
445
446 END_TEST();
447 }
448
449 {
450 ParserTest p(R"(cond %{CLIENT-URL:PATH} /\.html|\.txt/)");
451
452 CHECK_EQ(p.getTokens().size(), 3UL);
453 CHECK_EQ(p.get_op(), "CLIENT-URL:PATH");
454 CHECK_EQ(p.get_arg(), R"(/\.html|\.txt/)");
455 CHECK_EQ(p.is_cond(), true);
456
457 END_TEST();
458 }
459
460 {
461 ParserTest p(R"(cond %{CLIENT-URL:PATH} /\/foo\/bar/)");
462
463 CHECK_EQ(p.getTokens().size(), 3UL);
464 CHECK_EQ(p.get_op(), "CLIENT-URL:PATH");
465 CHECK_EQ(p.get_arg(), R"(/\/foo\/bar/)");
466 CHECK_EQ(p.is_cond(), true);
467
468 END_TEST();
469 }
470
471 {
472 ParserTest p("add-header X-HeaderRewriteApplied true");
473
474 CHECK_EQ(p.getTokens().size(), 3UL);
475 CHECK_EQ(p.get_op(), "add-header");
476 CHECK_EQ(p.get_arg(), "X-HeaderRewriteApplied");
477 CHECK_EQ(p.get_value(), "true");

Callers 1

mainFunction · 0.85

Calls 4

getTokensMethod · 0.80
is_condMethod · 0.80
sizeMethod · 0.45
get_valueMethod · 0.45

Tested by

no test coverage detected