Add `assert_contains_all` test helper in `managed_openclaw_guest`
Intent: Introduce a reusable assertion helper that checks a generated string contains every expected substring, producing a clear error message on failure. This avoids repeating individual `assert!(haystack.contains(...))` lines across multiple contract tests.
Affected files: crates/pika-server/src/managed_openclaw_guest.rs
@@ -748,6 +748,15 @@ mod tests {
use super::*;
use pika_cloud::{EVENTS_PATH, RESULT_PATH, STATUS_PATH};
+ fn assert_contains_all(haystack: &str, needles: &[&str]) {
+ for needle in needles {
+ assert!(
+ haystack.contains(needle),
+ "expected generated guest script to contain `{needle}`"
+ );
+ }
+ }
A small utility function assert_contains_all is added inside the existing mod tests block. It iterates over a slice of expected substrings and asserts each one is present in haystack, formatting a descriptive panic message that includes the missing needle.
This keeps subsequent contract tests compact—callers pass a single &[&str] slice instead of writing N separate assertions.