rs-zero 0.2.6

Rust-first microservice framework inspired by go-zero engineering practices
Documentation
#![allow(dead_code)]

pub mod stress;
use std::path::{Path, PathBuf};

pub fn fixture_path(relative: &str) -> PathBuf {
    Path::new(env!("CARGO_MANIFEST_DIR"))
        .join("tests/fixtures/goctl")
        .join(relative)
}

pub fn fixture_text(relative: &str) -> String {
    std::fs::read_to_string(fixture_path(relative)).expect("read goctl fixture")
}

pub fn normalize_text(value: &str) -> String {
    value
        .lines()
        .map(str::trim_end)
        .filter(|line| !line.trim().is_empty())
        .collect::<Vec<_>>()
        .join("\n")
}

pub fn assert_contains_all(haystack: &str, needles: &[&str]) {
    for needle in needles {
        assert!(
            haystack.contains(needle),
            "expected output to contain `{needle}`\n--- output ---\n{haystack}"
        );
    }
}