Skip to content
22 changes: 19 additions & 3 deletions docs/developers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,20 @@ Netsuke uses a mixed strategy:
adjacent to the code under test, included via
`#[cfg(test)] #[path = "..."] mod ...;` declarations.

Cargo discovers integration-test binaries only from Rust files directly below
`tests/`. Module trees rooted at `tests/*/mod.rs` must therefore be declared by
at least one top-level integration-test source, either with `mod name;` or an
explicit `#[path = "name/mod.rs"]` attribute. The narrowly scoped discovery
helpers in `tests/integration_test_wiring_tests.rs` own this structural check;
reuse them only for the immediate integration-test tree rather than as a
general Rust source parser.

The `std_filter_tests` target owns its command fixtures within
`tests/std_filter_tests/command_filters/`. `CommandFixture` provides the
capability-scoped temporary workspace, while `ShellCase` groups each
parameterized shell scenario. Keep both private to that test feature; shared
integration-test facilities belong in `test_support` instead.

The Dependabot integration tests parse the checked-in configuration and verify
that repository dependency manifests remain covered as the tree changes. They
assert the Cargo and GitHub Actions update policies, the configured schedules,
Expand Down Expand Up @@ -1930,9 +1944,11 @@ it forces a split layout with its own private `CARGO_TARGET_DIR` and
`CARGO_BUILD_BUILD_DIR` roots, confirms the collected dependency directories
span the split, and then compiles a fixture against them. The roots are
private to the test rather than the ambient target directory because the
`#[once]` `test_support_rlib` fixture builds concurrently in the other test;
sharing a target directory between the two races on the uplifted rlibs and
fails with version-skew errors (`E0460`).
`#[once]` `test_support_rlib` fixture builds concurrently for
`stub_env_default_does_not_compile` and
`stub_env_builders_compile_under_the_same_harness`. Sharing a target
directory would make `harness_compiles_under_a_split_build_dir` race that
build on the uplifted rlibs and fail with version-skew errors (`E0460`).

### Manifest `env()` reader

Expand Down
32 changes: 18 additions & 14 deletions src/stdlib/command/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ mod tests {
use super::*;
use crate::localization::{self, keys};

/// Assert `failure` renders for `command` as `expected`; callers keep their
/// own failure construction and localized message assembly.
fn assert_command_error_message(failure: CommandFailure, command: &str, expected: &str) {
let err = command_error(failure, "template.html", command);
assert_eq!(err.kind(), ErrorKind::InvalidOperation);
assert_eq!(err.to_string(), format!("invalid operation: {expected}"));
}

/// `category()` supplies the bounded `error_category` label on the command
/// execution span and counter, so every variant must map to a stable,
/// low-cardinality string. Constructing each variant here also means a new
Expand Down Expand Up @@ -277,18 +285,16 @@ mod tests {

#[test]
fn spawn_errors_include_source() {
let err = command_error(
CommandFailure::Spawn(io::Error::new(io::ErrorKind::NotFound, "command not found")),
"template.html",
"missing_cmd",
);
assert_eq!(err.kind(), ErrorKind::InvalidOperation);
let location = CommandLocation::new("template.html", "missing_cmd").describe();
let expected = localization::message(keys::COMMAND_SPAWN_FAILED)
.with_arg("location", location)
.with_arg("details", "command not found")
.to_string();
assert_eq!(err.to_string(), format!("invalid operation: {expected}"));
assert_command_error_message(
CommandFailure::Spawn(io::Error::new(io::ErrorKind::NotFound, "command not found")),
"missing_cmd",
&expected,
);
}

#[test]
Expand Down Expand Up @@ -378,17 +384,15 @@ mod tests {

#[test]
fn timeout_errors_report_duration() {
let err = command_error(
CommandFailure::Timeout(Duration::from_secs(3)),
"template.html",
"sleep",
);
assert_eq!(err.kind(), ErrorKind::InvalidOperation);
let location = CommandLocation::new("template.html", "sleep").describe();
let expected = localization::message(keys::COMMAND_TIMEOUT)
.with_arg("location", location)
.with_arg("seconds", 3.0)
.to_string();
assert_eq!(err.to_string(), format!("invalid operation: {expected}"));
assert_command_error_message(
CommandFailure::Timeout(Duration::from_secs(3)),
"sleep",
&expected,
);
}
}
Loading
Loading