-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds no-exit-message
Setting and [exit-message]
attribute
#2568
base: master
Are you sure you want to change the base?
Adds no-exit-message
Setting and [exit-message]
attribute
#2568
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
- I think there is an additional test case, just a plain recipe with the
[no-exit-message]
attribute with no setting. -
[exit-message]
and[no-exit-message]
on the same recipe should produce an error, and this should also have a test
src/attribute.rs
Outdated
@@ -17,6 +17,7 @@ pub(crate) enum Attribute<'src> { | |||
Macos, | |||
NoCd, | |||
NoExitMessage, | |||
ExitMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be sorted alphabetically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/attribute.rs
Outdated
@@ -36,6 +37,7 @@ impl AttributeDiscriminant { | |||
| Self::Macos | |||
| Self::NoCd | |||
| Self::NoExitMessage | |||
| Self::ExitMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be sorted alphabetically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/attribute.rs
Outdated
@@ -84,6 +86,7 @@ impl<'src> Attribute<'src> { | |||
AttributeDiscriminant::Macos => Self::Macos, | |||
AttributeDiscriminant::NoCd => Self::NoCd, | |||
AttributeDiscriminant::NoExitMessage => Self::NoExitMessage, | |||
AttributeDiscriminant::ExitMessage => Self::ExitMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/attribute.rs
Outdated
@@ -133,6 +136,7 @@ impl Display for Attribute<'_> { | |||
| Self::Macos | |||
| Self::NoCd | |||
| Self::NoExitMessage | |||
| Self::ExitMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/justfile.rs
Outdated
@@ -724,6 +724,54 @@ mod tests { | |||
} | |||
} | |||
|
|||
run_error! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to move away from the test generation macros. New tests should be integration tests, and use Test::new()
, see examples in the tests
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/settings.rs
Outdated
@@ -67,6 +68,9 @@ impl<'src> Settings<'src> { | |||
Setting::Quiet(quiet) => { | |||
settings.quiet = quiet; | |||
} | |||
Setting::NoExitMessage(no_exit_message) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/json.rs
Outdated
@@ -86,6 +86,7 @@ struct Settings<'a> { | |||
ignore_comments: bool, | |||
positional_arguments: bool, | |||
quiet: bool, | |||
no_exit_message: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
tests/no_exit_message.rs
Outdated
@@ -129,3 +129,67 @@ hello: | |||
stderr: "", | |||
status: 100, | |||
} | |||
|
|||
test! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should use the Test::new()
builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/no_exit_message.rs
Outdated
} | ||
|
||
|
||
test! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test can be removed, since whether or not a recipe is silent doesn't interact with exit messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/no_exit_message.rs
Outdated
status: 100, | ||
} | ||
|
||
test! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test can be removed. It would be a quite weird interaction in this code if this failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments done.
Added additional suggested tests and moved all tests to no_exit_messsage.rs
.
Also added a commit to refactor the other tests in no_exit_messsage.rs
to Test::new()
if that is suitable for this PR.
Let me know if there is anything else that needs changing.
tests/no_exit_message.rs
Outdated
@@ -129,3 +129,67 @@ hello: | |||
stderr: "", | |||
status: 100, | |||
} | |||
|
|||
test! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/json.rs
Outdated
@@ -86,6 +86,7 @@ struct Settings<'a> { | |||
ignore_comments: bool, | |||
positional_arguments: bool, | |||
quiet: bool, | |||
no_exit_message: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/attribute.rs
Outdated
@@ -17,6 +17,7 @@ pub(crate) enum Attribute<'src> { | |||
Macos, | |||
NoCd, | |||
NoExitMessage, | |||
ExitMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/attribute.rs
Outdated
@@ -36,6 +37,7 @@ impl AttributeDiscriminant { | |||
| Self::Macos | |||
| Self::NoCd | |||
| Self::NoExitMessage | |||
| Self::ExitMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/attribute.rs
Outdated
@@ -84,6 +86,7 @@ impl<'src> Attribute<'src> { | |||
AttributeDiscriminant::Macos => Self::Macos, | |||
AttributeDiscriminant::NoCd => Self::NoCd, | |||
AttributeDiscriminant::NoExitMessage => Self::NoExitMessage, | |||
AttributeDiscriminant::ExitMessage => Self::ExitMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/setting.rs
Outdated
@@ -34,6 +35,7 @@ impl Display for Setting<'_> { | |||
| Self::IgnoreComments(value) | |||
| Self::PositionalArguments(value) | |||
| Self::Quiet(value) | |||
| Self::NoExitMessage(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/settings.rs
Outdated
@@ -18,6 +18,7 @@ pub(crate) struct Settings<'src> { | |||
pub(crate) ignore_comments: bool, | |||
pub(crate) positional_arguments: bool, | |||
pub(crate) quiet: bool, | |||
pub(crate) no_exit_message: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/settings.rs
Outdated
@@ -67,6 +68,9 @@ impl<'src> Settings<'src> { | |||
Setting::Quiet(quiet) => { | |||
settings.quiet = quiet; | |||
} | |||
Setting::NoExitMessage(no_exit_message) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/no_exit_message.rs
Outdated
status: 100, | ||
} | ||
|
||
test! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/no_exit_message.rs
Outdated
} | ||
|
||
|
||
test! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This adds both the
no-exit-message
setting and the[exit-message]
attribute. Current behaviour is[exit-message]
overrides bothset no-exit-message
and[no-exit-message]
.Idea from #2566.
I would like feedback on whether I need to add anything to the documents and whether any test cases are missing.