Skip to content

Commit

Permalink
Fixed pest_tests doc (#8)
Browse files Browse the repository at this point in the history
Fix `skip_rules` documentation and improve formatting. Co-authored-by: Radoslav Kvasňovský <[email protected]>
  • Loading branch information
rKvasno authored Oct 5, 2023
1 parent a5eebab commit 904a56a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pest-test-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
/// * <parser type>: (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`.
/// * <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 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'.
Expand All @@ -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 {
Expand Down

0 comments on commit 904a56a

Please sign in to comment.