diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs index 058c7f87d..9ac886993 100644 --- a/tvix/eval/src/value/string.rs +++ b/tvix/eval/src/value/string.rs @@ -58,6 +58,23 @@ impl Hash for NixString { } } +#[cfg(feature = "arbitrary")] +mod arbitrary { + use super::*; + use proptest::prelude::{any_with, Arbitrary}; + use proptest::strategy::{BoxedStrategy, Strategy}; + + impl Arbitrary for NixString { + type Parameters = ::Parameters; + + type Strategy = BoxedStrategy; + + fn arbitrary_with(args: Self::Parameters) -> Self::Strategy { + any_with::(args).prop_map(Self::from).boxed() + } + } +} + impl NixString { pub const NAME: Self = NixString(StringRepr::Smol(SmolStr::new_inline("name"))); pub const NAME_REF: &'static Self = &Self::NAME;