-
Notifications
You must be signed in to change notification settings - Fork 185
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
Update tutorials for 1.0 and automate testing where possible #2281
Comments
Do you have a preferred location/structure for the module ? For now, I'll just put it under |
|
Do you want to merge all 4 md files from the tutorial folder into one giant tutorial.rs file ? |
You could make a directory |
There's actually a way to make .md files contain rust code that will be tested just by adding a few directive. #[doc = include_str!("../../../docs/tutorials/intro.md")]
#[doc = include_str!("../../../docs/tutorials/data_provider.md")]
#[doc = include_str!("../../../docs/tutorials/writing_a_new_data_struct.md")]
#[cfg(doctest)]
pub struct Docs; Also, I need some help with the "writing a new data struct". I could not manage to get a "simple version" that just compiles and run. For now, I've remove the examples code from Exemple of how it looks: icu4x/provider/core/src/hello_world.rs Lines 105 to 122 in dbb02a1
Only problem is that blob is linked to a specific version of the file, I don't think it can follow "head". (May be there's a trick I don't know about ?) Let me know what you think :) |
Replace the commit hash with |
I've tried, it doesn't work :'( https://github.com/unicode-org/icu4x/blob/main/provider/core/src/hello_world.rs#L105-L122 |
that link works, it won't inline it though, if that's what you were wondering. |
The point was to actually have it point to an actual code in repository, but displayable for doc. Current doc right now points to files and have code snippet. I managed to point it back to where it moved. |
Yeah that's not really possible, sadly. |
I'm unfortunately moving this issue to the 1.1 milestone since it is not a strict blocker to the 1.0 code release. However, we still want the tutorials ready for the 1.0 blog post and publicity which is in the coming week. |
I think we have a Chicken and egg problem in rust code need to compile, but using include on a non-existing May be there's something I missed in the development process for the users ? |
@dsipasseuth you can do I don't quite understand the rest of your problem |
It's not about the doc itself, it's about the tutorial itself. On an app that doesn't use ICU4X yet, and want to use it. let's consider this app not using ICU4X
This commands fails. (there's nothing to generate, because... well, there's nothing !)
But if the user add this in his code, it doesn't compile anymore... because the file does not exists. (if it doesn't compile, there's nothing in
Not sure if I'm clear. May be it's just overthinking it. |
Ah, I see, you're talking about the BakedDataProvider stuff. So yes, you cannot use static data slicing if your application only supports BakedDataProvider. There are other ways to get the list of keys, and there are other kinds of providers you can use in the meantime. |
I think the fix here could just be to not error in datagen if no keys are selected |
Actually this is a proper bug in datagen, the Rust API allows no keys, so the CLI should as well. #2731 |
ok, doctest are being performed for tutorials whenever possible. closing this bug. |
The tutorials in files such as "intro.md" are woefully out of date. We should make sure they are updated for 1.0, and also automate testing as much as possible, e.g. by moving code samples into a module such as
icu::tutorial
and using docs tests.The text was updated successfully, but these errors were encountered: