rosavox/lib/alveolata/url/test.spec.json
2025-05-23 07:33:29 +00:00

179 lines
2.8 KiB
JSON

{
"active": true,
"sections": [
{
"name": "query_encode",
"active": true,
"execution": {
"call": "\\alveolata\\url\\form_encode({{data}})"
},
"cases": [
{
"name": "null",
"active": true,
"input": {
"data": null
},
"output": {
"kind": "regular",
"value": null
}
},
{
"name": "empty",
"active": true,
"input": {
"data": {
}
},
"output": {
"kind": "regular",
"value": ""
}
},
{
"name": "single_entry_with_null_value",
"active": true,
"input": {
"data": {
"foo": null
}
},
"output": {
"kind": "regular",
"value": "foo"
}
},
{
"name": "single_entry_with_string_value",
"active": true,
"input": {
"data": {
"foo": "bar"
}
},
"output": {
"kind": "regular",
"value": "foo=bar"
}
},
{
"name": "complex",
"active": true,
"input": {
"data": {
"foo": null,
"baz": "qux"
}
},
"output": {
"kind": "regular",
"value": "foo&baz=qux"
}
}
]
},
{
"name": "encode",
"active": true,
"execution": {
"call": "\\alveolata\\url\\encode({{parts}})"
},
"cases": [
{
"name": "empty",
"active": true,
"input": {
"parts": {
}
},
"output": {
"kind": "crashes"
}
},
{
"name": "scheme_only",
"active": true,
"input": {
"parts": {
"scheme": "http"
}
},
"output": {
"kind": "crashes"
}
},
{
"name": "host_only",
"active": true,
"input": {
"parts": {
"host": "example.org"
}
},
"output": {
"kind": "regular",
"value": "example.org"
}
},
{
"name": "path_only",
"active": true,
"input": {
"parts": {
"path": ["foo", "bar"]
}
},
"output": {
"kind": "regular",
"value": "/foo/bar"
}
},
{
"name": "query_only",
"active": true,
"input": {
"parts": {
"query": "baz=2&qux=3"
}
},
"output": {
"kind": "regular",
"value": "?baz=2&qux=3"
}
},
{
"name": "hash_only",
"active": true,
"input": {
"parts": {
"hash": "blub"
}
},
"output": {
"kind": "regular",
"value": "#blub"
}
},
{
"name": "complex",
"active": true,
"input": {
"parts": {
"scheme": "git",
"host": "example.org",
"path": ["foo", "bar"],
"query": "baz=2&qux=3",
"hash": "blub"
}
},
"output": {
"kind": "regular",
"value": "git://example.org/foo/bar?baz=2&qux=3#blub"
}
}
]
}
]
}