Make fallback setting default to true (#1384)

This commit is contained in:
Casey Rodarmor 2022-10-26 22:00:31 -07:00 committed by GitHub
parent be11a26226
commit 0bbdb61ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 41 deletions

View File

@ -5,7 +5,7 @@ pub(crate) const DEFAULT_SHELL_ARGS: &[&str] = &["-cu"];
pub(crate) const WINDOWS_POWERSHELL_SHELL: &str = "powershell.exe"; pub(crate) const WINDOWS_POWERSHELL_SHELL: &str = "powershell.exe";
pub(crate) const WINDOWS_POWERSHELL_ARGS: &[&str] = &["-NoLogo", "-Command"]; pub(crate) const WINDOWS_POWERSHELL_ARGS: &[&str] = &["-NoLogo", "-Command"];
#[derive(Debug, PartialEq, Serialize, Default)] #[derive(Debug, PartialEq, Serialize)]
pub(crate) struct Settings<'src> { pub(crate) struct Settings<'src> {
pub(crate) allow_duplicate_recipes: bool, pub(crate) allow_duplicate_recipes: bool,
pub(crate) dotenv_load: Option<bool>, pub(crate) dotenv_load: Option<bool>,
@ -67,6 +67,23 @@ impl<'src> Settings<'src> {
} }
} }
impl<'src> Default for Settings<'src> {
fn default() -> Self {
Self {
allow_duplicate_recipes: false,
dotenv_load: None,
export: false,
fallback: true,
ignore_comments: false,
positional_arguments: false,
shell: None,
tempdir: None,
windows_powershell: false,
windows_shell: None,
}
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View File

@ -6,8 +6,6 @@ fn runs_recipe_in_parent_if_not_found_in_current() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
baz: baz:
echo subdir echo subdir
" "
@ -70,8 +68,6 @@ fn print_error_from_parent_if_recipe_not_found_in_current() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
baz: baz:
echo subdir echo subdir
" "
@ -100,8 +96,6 @@ fn requires_unstable() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
baz: baz:
echo subdir echo subdir
" "
@ -121,6 +115,7 @@ fn requires_unstable() {
} }
#[test] #[test]
#[ignore]
fn requires_setting() { fn requires_setting() {
Test::new() Test::new()
.tree(tree! { .tree(tree! {
@ -150,8 +145,6 @@ fn works_with_provided_search_directory() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
baz: baz:
echo subdir echo subdir
" "
@ -159,8 +152,6 @@ fn works_with_provided_search_directory() {
}) })
.justfile( .justfile(
" "
set fallback
foo: foo:
echo root echo root
", ",
@ -184,8 +175,6 @@ fn doesnt_work_with_justfile() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
baz: baz:
echo subdir echo subdir
" "
@ -193,8 +182,6 @@ fn doesnt_work_with_justfile() {
}) })
.justfile( .justfile(
" "
set fallback
foo: foo:
echo root echo root
", ",
@ -212,8 +199,6 @@ fn doesnt_work_with_justfile_and_working_directory() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
baz: baz:
echo subdir echo subdir
" "
@ -221,8 +206,6 @@ fn doesnt_work_with_justfile_and_working_directory() {
}) })
.justfile( .justfile(
" "
set fallback
foo: foo:
echo root echo root
", ",
@ -247,8 +230,6 @@ fn prints_correct_error_message_when_recipe_not_found() {
.tree(tree! { .tree(tree! {
bar: { bar: {
justfile: " justfile: "
set fallback
bar: bar:
echo subdir echo subdir
" "
@ -280,15 +261,11 @@ fn multiple_levels_of_fallback_work() {
a: { a: {
b: { b: {
justfile: " justfile: "
set fallback
foo: foo:
echo subdir echo subdir
" "
}, },
justfile: " justfile: "
set fallback
bar: bar:
echo subdir echo subdir
" "
@ -321,12 +298,12 @@ fn stop_fallback_when_fallback_is_false() {
a: { a: {
b: { b: {
justfile: " justfile: "
set fallback
foo: foo:
echo subdir echo subdir
" "
}, },
justfile: " justfile: "
set fallback := false
bar: bar:
echo subdir echo subdir
" "

View File

@ -43,7 +43,7 @@ fn alias() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
"tempdir" : null, "tempdir" : null,
@ -75,7 +75,7 @@ fn assignment() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -121,7 +121,7 @@ fn body() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -178,7 +178,7 @@ fn dependencies() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -272,7 +272,7 @@ fn dependency_argument() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -329,7 +329,7 @@ fn duplicate_recipes() {
"allow_duplicate_recipes": true, "allow_duplicate_recipes": true,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -368,7 +368,7 @@ fn doc_comment() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -394,7 +394,7 @@ fn empty_justfile() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -535,7 +535,7 @@ fn parameters() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -612,7 +612,7 @@ fn priors() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -651,7 +651,7 @@ fn private() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -690,7 +690,7 @@ fn quiet() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -793,7 +793,7 @@ fn shebang() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -832,7 +832,7 @@ fn simple() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"ignore_comments": false, "ignore_comments": false,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
@ -874,7 +874,7 @@ fn attribute() {
"allow_duplicate_recipes": false, "allow_duplicate_recipes": false,
"dotenv_load": null, "dotenv_load": null,
"export": false, "export": false,
"fallback": false, "fallback": true,
"positional_arguments": false, "positional_arguments": false,
"shell": null, "shell": null,
"tempdir" : null, "tempdir" : null,