From d3d3c4e48fd8e6057a9eec5ae859e7a55daae9f9 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Wed, 28 Aug 2024 15:10:40 -0700 Subject: [PATCH] Allow fallback with recipes in submodules (#2329) --- src/subcommand.rs | 2 +- tests/fallback.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/subcommand.rs b/src/subcommand.rs index fa6f1e0b7e..cbb53d89fa 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -147,7 +147,7 @@ impl Subcommand { }; match Self::run_inner(config, loader, arguments, overrides, &search) { - Err((err @ Error::UnknownRecipe { .. }, true)) => { + Err((err @ (Error::UnknownRecipe { .. } | Error::UnknownSubmodule { .. }), true)) => { match search.justfile.parent().unwrap().parent() { Some(parent) => { unknown_recipes_errors.get_or_insert(err); diff --git a/tests/fallback.rs b/tests/fallback.rs index 3330e17afb..238a12a7c8 100644 --- a/tests/fallback.rs +++ b/tests/fallback.rs @@ -362,3 +362,15 @@ fn stop_fallback_when_fallback_is_false() { .status(EXIT_FAILURE) .run(); } + +#[test] +fn works_with_modules() { + Test::new() + .write("bar/justfile", "set fallback := true") + .write("foo.just", "baz:\n @echo BAZ") + .justfile("mod foo") + .args(["foo::baz"]) + .current_dir("bar") + .stdout("BAZ\n") + .run(); +}