Skip to main content

Module util

Module util 

Source

Structs§

SummaryCounts
Parsed summary counts from a test result line.
SummaryPatterns
Summary count patterns for different test frameworks.

Functions§

build_test_command
Build a Command with the given program and arguments, set to run in the project dir.
check_binary
Check if a binary is available on PATH. Returns the full path if found.
check_runner_binary
Check if a binary is available, returning the missing name if not.
combined_output
Combine stdout and stderr into a single string for parsing.
count_pattern
Count lines matching a pattern in the output.
duration_from_secs_safe
Create a Duration from seconds, returning Duration::ZERO for NaN, infinity, or negative values. This is a safe wrapper around Duration::from_secs_f64 which panics on such inputs.
ensure_non_empty
Ensure a suite list is non-empty by adding a fallback suite based on exit code.
extract_count
Extract a number from a string that appears before a keyword. E.g., extract_count(“3 passed”, “passed”) => Some(3)
extract_error_context
Extract error context from output lines around a failure. Scans for common failure indicators and returns surrounding context.
fallback_result
Build a fallback TestRunResult when output can’t be parsed into individual tests. Uses exit code to determine pass/fail.
format_duration
Format a Duration as a human-readable string.
has_marker_in_subdirs
Check if any file matching predicate exists in immediate subdirectories of dir.
make_detection
Build a detection result with the given parameters.
parse_duration_str
Parse a duration string in common formats: “5ms”, “1.5s”, “0.01 sec”, “(5 ms)”, “123ms”, “1.23s”, “0.001s”, “5.2 seconds”
parse_summary_line
Parse counts from a summary line using the given patterns.
synthetic_tests_from_counts
Generate synthetic test cases from summary counts. Used when the adapter can only extract totals, not individual test names.
truncate
Truncate a string to a max length, adding “…” if truncated.
xml_escape
Escape a string for safe XML output.