Skip to content
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

Rust: generate test code from schema docstrings #17396

Merged
merged 7 commits into from
Sep 9, 2024

Commits on Sep 6, 2024

  1. Rust: generate test code from schema docstrings

    This generates test source files from code blocks in class docstrings.
    
    By default the test code is generated as is, but it can optionally:
    * be wrapped in a function providing an adequate context using
      `@rust.doc_test_function(name, *, lifetimes=(), return_type="()", **kwargs)`,
      with `kwargs` providing both generic and normal params depending on
      capitalization
    * be skipped altogether using `@rust.skip_doc_test`
    
    So for example an annotation like
    ```python
    @rust.doc_test_function("foo",
                            lifetimes=("a",),
                            T="Eq",
                            x="&'a T",
                            y="&'a T",
                            return_type="&'a T")
    ```
    will result in the following wrapper:
    ```rust
    fn foo<'a, T: Eq>(x: &'a T, y: &'a T) -> &'a T {
        // example code here
    }
    ```
    Paolo Tranquilli committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    8c5cc2e View commit details
    Browse the repository at this point in the history
  2. Rust: remove accidental schema annotation

    Paolo Tranquilli committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    6111a74 View commit details
    Browse the repository at this point in the history
  3. Rust: fix formatting of code snippet in docstring

    Paolo Tranquilli committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    18c423e View commit details
    Browse the repository at this point in the history
  4. Rust: remove accidental test source file

    Paolo Tranquilli committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    ac9e977 View commit details
    Browse the repository at this point in the history
  5. Rust: remove <> from function wrapper

    Paolo Tranquilli committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    928f3f1 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2024

  1. Rust: simplify rust doc test annotation

    Paolo Tranquilli committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    3cd8aaf View commit details
    Browse the repository at this point in the history
  2. Merge branch 'rust-experiment' into redsun82/rust-doctest-gen

    Paolo Tranquilli committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    10a23c0 View commit details
    Browse the repository at this point in the history