subtest 1.0.3

macro to easily use test setup code from one test function in another one
Documentation
//! Fixtures for macro expansion snapshots, which are also compiled and run as ordinary tests

#![deny(
    clippy::allow_attributes,
    clippy::allow_attributes_without_reason,
    reason = "the lint attributes generated by the macro are #[allow]s and state no reason, \
              which must stay acceptable in a project denying either - clippy does not apply \
              these lints to attributes coming out of a macro"
)]
#![deny(
    unfulfilled_lint_expectations,
    reason = "the fixtures pin down with #[expect] which lints the macro must keep firing - an \
              expectation going unfulfilled is a regression"
)]
#![deny(
    clippy::pedantic,
    reason = "code generated by the macro must hold up in a project enabling the pedantic lints"
)]
#![allow(
    clippy::too_many_lines,
    reason = "clippy.toml has an extremely low threshold for the too_many_lines_expectation fixture"
)]
#![allow(
    clippy::ignore_without_reason,
    reason = "bare #[ignore] is easier to read in examples"
)]

/// Test that all fixtures in the directory 'expands' expand to an expected output snapshot when
/// thrown at the subtest macro. Uses macrotest for snapshot management and assertions.
#[test]
pub fn test_snapshots() {
    let pwd = std::env::current_dir().unwrap();
    let pwd = pwd.to_str().unwrap();

    // without the '--tests' flag, `cargo expand` would just remove functions annotated with #[test]
    // without the '--remap-path-prefix', absolute paths to the input files would show up in the generated output snapshots
    macrotest::expand_without_refresh_args(
        "tests/integration_tests/expand/*.rs",
        [
            "--tests".to_string(),
            "--config".to_string(),
            format!("build.rustflags=[\"--remap-path-prefix={pwd}=.\"]"),
        ],
    );
}

// Also actually run the tests for which we do snapshot testing above
mod async_tests;
#[allow(
    clippy::allow_attributes,
    clippy::allow_attributes_without_reason,
    reason = "the fixture hand-writes lint attributes as part of what it tests - the module-wide \
                  deny is about the ones the macro generates"
)]
mod doc_comments;
mod failing_subtest;
#[allow(
    clippy::allow_attributes,
    clippy::allow_attributes_without_reason,
    reason = "the fixture hand-writes lint attributes as part of what it tests - the module-wide \
                  deny is about the ones the macro generates"
)]
mod helper_fn;
#[allow(
    clippy::allow_attributes,
    clippy::allow_attributes_without_reason,
    reason = "the fixture hand-writes lint attributes as part of what it tests - the module-wide \
                  deny is about the ones the macro generates"
)]
mod helper_fn_attrs;
mod inherited_expect_fulfilled;
mod inherited_expect_unfulfilled;
mod inherited_lint_expectation;
#[deny(
    clippy::items_after_statements,
    reason = "items after inherited statements should not trigger the lint"
)]
mod items_after_inherited_statements;
#[expect(
    clippy::items_after_statements,
    reason = "items after non-inherited statements should trigger the lint"
)]
mod items_after_statements;
#[expect(
    dead_code,
    reason = "since #[test] is missing, the function should lead to a dead code warning, \
                  like normal test functions which you forgot to annotate with #[test]"
)]
mod missing_test_attr;
#[expect(
    dead_code,
    reason = "since #[test] is missing, the function should lead to a dead code warning, \
                  like normal test functions which you forgot to annotate with #[test]"
)]
mod missing_test_attr_on_nested_subtest;
mod no_subtests;
mod readme_ambiguous_assert_import_solution1;
mod readme_ambiguous_assert_import_solution2;
mod readme_async_example;
mod readme_inheritance_example;
mod readme_parallel_setup_solution1;
mod readme_parallel_setup_solution2;
mod readme_todo_list_example;
mod readme_uninherited_ignore_example;
mod readme_unused_mut_solution1;
mod readme_unused_mut_solution2;
mod readme_unused_variables_solution;
#[deny(
    clippy::unused_unit,
    reason = "a subtest resetting its return type to () must not be reported as an unneeded \
                  unit return type"
)]
mod return_type_reset;
mod return_type_unused_unit;
mod rstest_tests;
#[deny(
    clippy::too_many_lines,
    reason = "the pedantic lint has to be enabled for the fixture's #[expect] attributes to \
                  be fulfilled - and a subtest must not be reported for lines it merely inherits"
)]
mod too_many_lines_expectation;
mod two_subtests;
mod uninherited_test_attrs;
mod unnecessary_wraps;
#[deny(
    clippy::unnecessary_wraps,
    reason = "disallow false positives for inherited return types"
)]
mod unnecessary_wraps_inherited;
#[deny(
    unused_assignments,
    reason = "values assigned in the parent test function must not be reported as never read \
                  in a subtest which does not read them"
)]
#[expect(
    clippy::needless_late_init,
    reason = "the fixture declares variables without a value on purpose - that is what makes \
                  the inherited statements assignments in the first place"
)]
mod unused_assignments_in_subtest;
#[deny(
    unused_mut,
    reason = "mut variables inherited from the parent test function must not be reported as \
                  unused_mut in a subtest which does not modify them"
)]
mod unused_mut_in_subtest;
#[deny(
    unused_mut,
    reason = "mut parameters inherited from the parent test function must not be reported as \
                  unused_mut in a subtest which does not modify them"
)]
mod unused_mut_in_subtest_parameter;
#[deny(
    unused_variables,
    reason = "variables inherited from the parent test function must not be reported as \
                  unused in a subtest which does not use them"
)]
mod unused_variables_in_subtest;
#[deny(
    unused_variables,
    reason = "parameters inherited from the parent test function must not be reported as \
                  unused in a subtest which does not use them"
)]
mod unused_variables_in_subtest_parameters;
#[deny(
    unused_variables,
    reason = "variables inherited from the parent test function must not be reported as \
                  unused in a subtest which does not use them"
)]
mod unused_variables_in_subtest_via_macro;