Skip to main content

Module test_util

Module test_util 

Source
Expand description

Test fixtures and helpers shared across ecosystem crates.

Test fixtures throughout the workspace write absolute paths in Unix style (e.g. /project/Cargo.toml) for readability. Uri::from_file_path requires a platform-absolute path, and a Unix-style path is not recognized as absolute on Windows (no drive letter), so calling it directly with such a literal panics on Windows only. test_uri normalizes the path per host platform before constructing the [Uri].

assert_dot_segment_gated_or_contained/assert_dot_segment_gated_or_contained_transformed guard the recurring dot-segment / unvalidated-URL-sink defect class (#337, #341, #349, #357, #361, #365, #371) against further recurrence.

capture_tracing_output/capture_tracing_output_async let a test assert a tracing call actually fired (originally added standalone in deps-swift for #357, then duplicated per-crate for #380/#378’s warn_rejected_value coverage before being consolidated here).

Constants§

ADVERSARIAL_URL_SEGMENTS
Canonical adversarial identifier values for the recurring dot-segment / unvalidated-URL-sink defect class (#337, #341, #349, #357, #361).

Functions§

assert_dot_segment_gated_or_contained
Exercises one ecosystem’s identifier-to-URL sink against every ADVERSARIAL_URL_SEGMENTS entry.
assert_dot_segment_gated_or_contained_transformed
As assert_dot_segment_gated_or_contained, but for a resolve whose production gate legitimately transforms the identifier before it reaches the URL builder.
capture_tracing_output
Captures tracing output emitted synchronously during f into a String.
capture_tracing_output_async
Async counterpart of capture_tracing_output, for a tracing emission inside an async fn/.awaited future.
capture_tracing_output_at
Like capture_tracing_output, but capturing every level up to and including max_level (e.g. tracing::Level::DEBUG).
test_uri
Builds a [Uri] from a Unix-style absolute test path.