-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: add mdbook plugin for testing mun code in book #263
Conversation
Also need to mention that this pr skip testing one code from chapter |
Codecov Report
@@ Coverage Diff @@
## master #263 +/- ##
==========================================
- Coverage 79.10% 78.82% -0.28%
==========================================
Files 219 220 +1
Lines 13024 13070 +46
==========================================
Hits 10303 10303
- Misses 2721 2767 +46
Continue to review full report at Codecov.
|
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.
Nice work @legendiguess. Very happy with this addition. I've added some minor remarks, but mostly it looks good to go.
Could you also remove book/listings/ch03-structs/mun.exe
? It's not necessary to have that committed 🙂
@legendiguess I see that you performed a merge. In the future, please do "rebase merges" instead. If you are unfamiliar with rebase merges, our contributing guidelines explain it in more detail here. |
Oh, sorry, it's was just due to my inexperience, i removed merge 👍 |
@legendiguess Do you need any help to fix the last couple of issues? |
427f974
to
cbc2a0d
Compare
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 looks a lot better. I recommended a few changes, because:
- I think we should use
no_run
instead ofrun
. I explained why in one of the comments inmain.rs
This means that by default, we always run the Mun source code, unless you specifyno_run
. - After looking at our CLI source code, it seems that just using
pub fn main
as the entry point for Mun source is the best option. That's the same for our mdbook plugin and the Mun CLI then. - I think we don't need
skip
anymore, now that the compiler bug is fixed. - I think
compile_fail
should always mean that nothing will run.
@@ -144,7 +150,10 @@ is specified too, as `-> i32`. | |||
Whereas the last expression in a block implicitly becomes that blocks return | |||
value, explicit `return` statements always return from the entire function: | |||
|
|||
```mun | |||
```mun,ignore |
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.
```mun,ignore | |
```mun |
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.
This should compile if you convert return bar + 3;
into return 3;
, I think
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.
Shouldn't it be a separate pr?
This pull request add mdbook plugin that's test all mun code(indicated by keyword
mun
before code block).Also, plugin allows to specify "testing method" for each code block by using keywords
no_run
,compile_fail
andskip
.Example:
mun,no_run
,mun,compile_fail
and etcWith this pull request, plugin already setted as dependency for mun book, so before building new version of book by
mdbook build
one need to compilemdbook-mun-examples-test
crate and add it's executable file to environment variables.closes #209