-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
defmt-test-macros
: Add before_each
and after_each
attributes.
#696
Conversation
962a80c
to
c6e1db1
Compare
before_each
and after_each
attributes.defmt-test-macros
: Add before_each
and after_each
attributes.
I have no idea why my changelog entry is considered insufficient. Any help? |
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 really good! I didn't try it out yet, and only read through it, but great work! I have some small nitpicks.
@@ -0,0 +1,5 @@ | |||
error: this type must match `#[init]`s return type |
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.
Can we add which type it should be?
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.
That would be a great improvement, thanks. Do you have a suggestion on how to convert state
to String here?
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.
Maybe https://doc.rust-lang.org/std/any/fn.type_name.html can help?
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.
Welp, I have to say I'm not convinced that there's no prettier way of printing the type name, but hopefully the last commit does what we want. It seems that type_name
won't help here, as there's no way of passing the type parameter to it. We need to obtain the type name from syn::Type
, to which I haven't found a nice solution.
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.
@Urhengulas How do you feel about the current version?
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 like it!
@hdoordt said:
The problem is that the CI expects you to change |
9deea62
to
c04017f
Compare
d919ce0
to
1ef19d6
Compare
1ef19d6
to
72dad44
Compare
Sorry for the delay. I was busy and didn't get around to take a second look at the PR. Thank you for your work! bors r+ |
@Urhengulas thanks for having a look! |
Build succeeded: |
Add
before_each
andafter_each
attributes todefmt-test-macros
. These attributes define functions that are called before and after each test case respectively.I use them myself to alter a pin state, signaling my power profiler whether an actual test is running, but this feature can be used in many other situations.
I have some doubt about (not completely, but mostly) duplicated code, but I'm not sure adding macros would make it any better. Any suggestions on cleaning that up are very welcome!
And of course, thanks to the Knurling team and all contributors for setting up a great set of crates!