A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/httpwg/structured-field-tests below:

httpwg/structured-field-tests: Tests for HTTP Structured Field Values

These are test cases for implementations of Structured Fields for HTTP.

Each test file is a JSON document that contains an array of test records. A test record is an object with the following members:

The expected data structure maps the types in Structured Fields to JSON as follows:

For any test that case that has a valid outcome (i.e. must_fail is not true) the expected data structure can be serialised. The expected result of this serialisation is the canonical member if specified, or raw otherwise. The canonical form of a List or Dictionary with no members is an empty array, to represent the field being omitted.

Test cases in the serialisation-tests directory can be used to test serialisation of an invalid or non-canonical value. The expected structure (as defined above) should serialise to the canonical form, unless must_fail is true -- in which case the value cannot be serialised. These cases do not have a raw element.

JSON Schemas for these formats are provided in the schemas directory.

Because JSON doesn't natively accommodate some data types that Structured Fields does, the expected member uses an object with a __type member and a value member to represent these values.

For example:

{
  "__type": "token",
  "value": "foo"
}

... carries a "foo" token. The following types are defined:

All tests should have a descriptive name. Tests should be as simple as possible - just what's required to test a specific piece of behavior. If you want to test interacting behaviors, create tests for each behavior as well as the interaction.

If a test file ends in -generated.json, please modify generate.py and re-generate the tests in your PR.

Please feel free to contribute!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4