| Crates.io | harmonia-utils-test |
| lib.rs | harmonia-utils-test |
| version | 0.0.0-alpha.0 |
| created_at | 2026-01-23 17:25:34.763208+00 |
| updated_at | 2026-01-23 17:25:34.763208+00 |
| description | Test utilities for Harmonia (proptest strategies, macros) |
| homepage | https://github.com/nix-community/harmonia |
| repository | https://github.com/nix-community/harmonia.git |
| max_upload_size | |
| id | 2065107 |
| size | 26,851 |
Proptest strategies and test macros for property-based testing.
This crate provides proptest strategies for generating test data and assertion macros for property-based testing of Harmonia crates. It should only be used as a dev-dependency.
arb_filename / arb_path - Strategies for generating valid filenames and pathsarb_byte_string - Strategy for generating arbitrary byte stringsarb_duration / arb_system_time - Strategies for time valueshelpers::Union - Weighted union of proptest strategiesuse harmonia_utils_test::{arb_path, arb_byte_string};
use proptest::prelude::*;
proptest! {
#[test]
fn roundtrip_path(path in arb_path()) {
let encoded = encode(&path);
let decoded = decode(&encoded)?;
prop_assert_eq!(path, decoded);
}
#[test]
fn roundtrip_bytes(data in arb_byte_string()) {
let compressed = compress(&data);
let decompressed = decompress(&compressed)?;
prop_assert_eq!(data, decompressed);
}
}
| Strategy | Generates |
|---|---|
arb_filename() |
Valid filenames (no . or ..) |
arb_path() |
Valid relative paths |
arb_file_component() |
Single path component |
arb_byte_string() |
Arbitrary bytes::Bytes |
arb_duration() |
std::time::Duration values |
arb_system_time() |
System time as duration |