Skip to content

Commit

Permalink
Change fallback setting default to false (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Nov 25, 2022
1 parent e7b7897 commit e0794d0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
19 changes: 1 addition & 18 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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_ARGS: &[&str] = &["-NoLogo", "-Command"];

#[derive(Debug, PartialEq, Serialize)]
#[derive(Debug, PartialEq, Serialize, Default)]
pub(crate) struct Settings<'src> {
pub(crate) allow_duplicate_recipes: bool,
pub(crate) dotenv_load: Option<bool>,
Expand Down Expand Up @@ -67,23 +67,6 @@ 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)]
mod tests {
use super::*;
Expand Down
15 changes: 14 additions & 1 deletion tests/fall_back_to_parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ fn runs_recipe_in_parent_if_not_found_in_current() {
.tree(tree! {
bar: {
justfile: "
set fallback := true
baz:
echo subdir
"
Expand Down Expand Up @@ -68,6 +70,8 @@ fn print_error_from_parent_if_recipe_not_found_in_current() {
.tree(tree! {
bar: {
justfile: "
set fallback := true
baz:
echo subdir
"
Expand Down Expand Up @@ -145,6 +149,8 @@ fn works_with_provided_search_directory() {
.tree(tree! {
bar: {
justfile: "
set fallback := true
baz:
echo subdir
"
Expand Down Expand Up @@ -230,6 +236,8 @@ fn prints_correct_error_message_when_recipe_not_found() {
.tree(tree! {
bar: {
justfile: "
set fallback := true
bar:
echo subdir
"
Expand Down Expand Up @@ -261,11 +269,15 @@ fn multiple_levels_of_fallback_work() {
a: {
b: {
justfile: "
set fallback := true
foo:
echo subdir
"
},
justfile: "
set fallback := true
bar:
echo subdir
"
Expand Down Expand Up @@ -298,12 +310,13 @@ fn stop_fallback_when_fallback_is_false() {
a: {
b: {
justfile: "
set fallback := true
foo:
echo subdir
"
},
justfile: "
set fallback := false
bar:
echo subdir
"
Expand Down
30 changes: 15 additions & 15 deletions tests/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn alias() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"positional_arguments": false,
"shell": null,
"tempdir" : null,
Expand Down Expand Up @@ -75,7 +75,7 @@ fn assignment() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -121,7 +121,7 @@ fn body() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -178,7 +178,7 @@ fn dependencies() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -272,7 +272,7 @@ fn dependency_argument() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -329,7 +329,7 @@ fn duplicate_recipes() {
"allow_duplicate_recipes": true,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -368,7 +368,7 @@ fn doc_comment() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand All @@ -394,7 +394,7 @@ fn empty_justfile() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -535,7 +535,7 @@ fn parameters() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -612,7 +612,7 @@ fn priors() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -651,7 +651,7 @@ fn private() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -690,7 +690,7 @@ fn quiet() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -793,7 +793,7 @@ fn shebang() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -832,7 +832,7 @@ fn simple() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"shell": null,
Expand Down Expand Up @@ -874,7 +874,7 @@ fn attribute() {
"allow_duplicate_recipes": false,
"dotenv_load": null,
"export": false,
"fallback": true,
"fallback": false,
"positional_arguments": false,
"shell": null,
"tempdir" : null,
Expand Down

0 comments on commit e0794d0

Please sign in to comment.