Update Structured Headers generated specification tests Re-generate `structured_headers_generated_test.cc` from the latest upstream `httpwg/structured-field-tests` repository. Updating the generated tests requires adding support for `can_fail` to the test generator and test harness. The test suite includes this boolean field to denote test cases covering optional behaviors (namely, ["partially padded" and "extra padding"](https://github.com/httpwg/structured-field-tests/issues/116)) where parsing failure is permissible. Without `can_fail` support, these tests are treated as required to succeed, causing test failures. Add `can_fail` to `ParameterizedItemTestCase`, `ListTestCase`, and `DictionaryTestCase`. Update `generate_structured_headers_tests.py` to parse and emit the `can_fail` flag, and update test assertions to permit parse failures when `c.can_fail` is true while continuing to verify matching values if parsing succeeds. PiperOrigin-RevId: 982568476
diff --git a/quiche/common/structured_headers_generated_test.cc b/quiche/common/structured_headers_generated_test.cc index 044dd67..26c80a2 100644 --- a/quiche/common/structured_headers_generated_test.cc +++ b/quiche/common/structured_headers_generated_test.cc
@@ -17,8 +17,8 @@ // being automatically translated from the JSON source to C++ unit tests. Please // do not modify, as the contents will be overwritten when this is re-generated. -// Generated on 2026-09-09 from structured-field-tests.git @ -// 1e280c3ed9ffe0ca5fdb1d97219dddc389007677. +// Generated on 2026-09-16 from structured-field-tests.git @ +// 00462dd7938b43bf596cb2af6a373d9c928a6cbe. namespace quiche { namespace structured_headers { @@ -57,6 +57,7 @@ expected; // nullopt if parse error is expected. const char* canonical; // nullptr if parse error is expected, or if canonical // format is identical to raw. + bool can_fail = false; const char* known_bug = nullptr; } parameterized_item_test_cases[] = { // binary.json @@ -68,11 +69,24 @@ {"empty binary", "::", 2, {{Item(Item::byte_sequence, ""), {}}}, nullptr}, {"padding at beginning", ":=aGVsbG8=:", 11, std::nullopt, nullptr}, {"padding in middle", ":a=GVsbG8=:", 11, std::nullopt, nullptr}, - {"bad padding", + {"unpadded", ":aGVsbG8:", 9, {{Item(Item::byte_sequence, "hello"), {}}}, - ":aGVsbG8=:"}, + ":aGVsbG8=:", + true}, + {"partially padded", + ":uuueGVsbG8=:", + 13, + {{Item(Item::byte_sequence, "\272\353\236\031[\033\033"), {}}}, + ":uuueGVsbGw==:", + true}, + {"extra padding", + ":aGVsbG8==:", + 11, + {{Item(Item::byte_sequence, "hello"), {}}}, + ":aGVsbG8=:", + true}, {"bad padding dot", ":aGVsbG8.:", 10, std::nullopt, nullptr}, {"bad end delimiter", ":aGVsbG8=", 9, std::nullopt, nullptr}, {"extra whitespace", ":aGVsb G8=:", 11, std::nullopt, nullptr}, @@ -83,7 +97,8 @@ ":iZ==:", 6, {{Item(Item::byte_sequence, "\211"), {}}}, - ":iQ==:"}, + ":iQ==:", + true}, {"non-ASCII binary", ":/+Ah:", 6, @@ -2413,7 +2428,8 @@ "\"foo, bar\"", 10, {{Item(Item::string, "foo, bar"), {}}}, - "\"foo, bar\""}, + "\"foo, bar\"", + true}, // token-generated.json {"0x00 in token", "a\000a", 3, std::nullopt, nullptr}, {"0x01 in token", "a\001a", 3, std::nullopt, nullptr}, @@ -2912,6 +2928,7 @@ const std::optional<List> expected; // nullopt if parse error is expected. const char* canonical; // nullptr if parse error is expected, or if canonical // format is identical to raw. + bool can_fail = false; const char* known_bug = nullptr; } list_test_cases[] = { // examples.json @@ -5863,6 +5880,7 @@ expected; // nullopt if parse error is expected. const char* canonical; // nullptr if parse error is expected, or if canonical // format is identical to raw. + bool can_fail = false; const char* known_bug = nullptr; } dictionary_test_cases[] = { // dictionary.json @@ -9074,6 +9092,8 @@ << " passed but was expected to fail (" << c.known_bug << "); please remove from KNOWN_BUGS"; } + } else if (c.can_fail && !result.has_value()) { + // Failing this test is acceptable per spec. } else { EXPECT_EQ(result, c.expected); } @@ -9093,6 +9113,8 @@ << " passed but was expected to fail (" << c.known_bug << "); please remove from KNOWN_BUGS"; } + } else if (c.can_fail && !result.has_value()) { + // Failing this test is acceptable per spec. } else { EXPECT_EQ(result, c.expected); } @@ -9112,6 +9134,8 @@ << " passed but was expected to fail (" << c.known_bug << "); please remove from KNOWN_BUGS"; } + } else if (c.can_fail && !result.has_value()) { + // Failing this test is acceptable per spec. } else { EXPECT_EQ(result, c.expected); }