From 904a56ac2c056c891a860ad59824bd72f99626c6 Mon Sep 17 00:00:00 2001 From: rKvasno <9394947+rKvasno@users.noreply.github.com> Date: Thu, 5 Oct 2023 21:18:43 +0200 Subject: [PATCH] Fixed pest_tests doc (#8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix `skip_rules` documentation and improve formatting. Co-authored-by: Radoslav Kvasňovský --- pest-test-gen/src/lib.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pest-test-gen/src/lib.rs b/pest-test-gen/src/lib.rs index 767a25b..f6b2f7b 100644 --- a/pest-test-gen/src/lib.rs +++ b/pest-test-gen/src/lib.rs @@ -290,12 +290,12 @@ fn add_tests(module: &mut ItemMod, args: &Args) { /// is created and used by all the generated test functions (dependency on `lazy_static` is /// required), otherwise a separate instance is created for each test. /// -/// Arguments: -/// * : (required) the full path to the struct you defined that derives `pest::Parser`, +/// # Arguments: +/// * **parser_type**: (required) the full path to the struct you defined that derives `pest::Parser`, /// e.g. `mycrate::parser::MyParser`. -/// * : (required) the full path to the `Rule` enum, e.g. `mycrate::parser::Rule`. -/// * : (required) the name of the `Rule` variant from which to start parsing. -/// * skip_rules: (optional) a list of rules to skip when parsing; by default `Rule::EOI` is +/// * **rule_type**: (required) the full path to the `Rule` enum, e.g. `mycrate::parser::Rule`. +/// * **rule_name**: (required) the name of the `Rule` variant from which to start parsing. +/// * skip_rules: (optional) a list of names of rules to skip when parsing; by default `Rule::EOI` is /// skipped unless `no_eoi = true`. /// * no_eoi: (optional) there is no `Rule::EOI` - don't automatically add it to `skip_rules`. /// * dir: (optional) the root directory where pest test cases are found; defaults to 'tests/pest'. @@ -309,20 +309,25 @@ fn add_tests(module: &mut ItemMod, args: &Args) { /// * lazy_static: (optional) whether to create a singleton `PestTester` - requires dependency on /// `lazy_static`; defaults to `false`. /// -/// Example: +/// # Example: +/// ``` +/// /// use pest_test_gen; /// /// #[pest_tests( /// mycrate::parser::MyParser, /// mycrate::parser::Rule, /// "root_rule", -/// skip_rules = (mycrate::parser::Rule::comment), +/// skip_rules("comment"), /// subdir = "foo", /// recursive = true, /// lazy_static = true /// )] /// #[cfg(test)] /// mod parser_tests {} +/// +/// ``` + #[proc_macro_attribute] #[proc_macro_error] pub fn pest_tests(attr: TokenStream, item: TokenStream) -> TokenStream {