-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Immediate Execution of Commands
on a &mut World
#6186
Conversation
As you mention in your doc comment, this is a very inefficient way to execute a command when you have a world available. If this is only to be used for test, I would rather it being not available outside of tests |
I considered doing this initially. There is a couple of problems with this:
For these reasons, I decided keeping it available but with a warning in the comments is probably the best option. Also, |
This came up before in my other PRs for testing utilities. I think that the trait (that's not in the prelude) is a reasonable approach. I would also support the creation of a |
I like this idea, but I would suggest naming it some more generic like |
Well, we have |
Let me know if we want to move the entire implementation into a separate file |
Yes please :) |
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.
Awesome. Can you add an example for this? Maybe in the root tests directory? I would suggest you link it from the Commands docs but we can't, because circular dependencies.
Also fixed more doctest errors.
I added an example under Also, I'm not sure if it was just me, but an issue I discovered while testing:
|
Today I realized I accidentally deleted the repository for this. 😢 |
Objective
Fixed #6184
Solution
This PR adds an
Execute
trait which is implemented for&mut World
and&mut App
. It allows the user to do this: