runs 0.2.0

A CLI tool to run Rust documentation tests (doctests) on standalone .rs files by generating a temporary Cargo project.
Documentation
  • Coverage
  • 85.71%
    6 out of 7 items documented4 out of 5 items with examples
  • Size
  • Source code size: 14.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.24 MB This is the summed size of all files generated by rustdoc for all configured targets
  • ร˜ build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Documentation
  • 2teez/runs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 2teez
runs-0.2.0 has been yanked.

๐Ÿ“š runs โ€“ Run Rust Doctests on Standalone Files

runs lets you execute Rust documentation tests (doctests) on a standalone .rs file, even if it's not part of a full Cargo project.

Normally, cargo test --doc works only inside valid Cargo projects. runs bridges this limitation.


โœจ Features

  • โœ… Accepts a standalone .rs file with doctests
  • ๐Ÿ› ๏ธ Automatically creates a temporary Cargo project
  • ๐Ÿงช Runs cargo test --doc on the file
  • ๐Ÿงผ Cleans up the temp project after running
  • ๐Ÿ’ก Optional usage as a library crate

๐Ÿ”ง Installation

Install from crates.io

cargo install runs

Or from source

git clone https://github.com/2teez/runs.git

cd runs

cargo install --path .

๐Ÿš€ Usage

runs my_script.rs

This will:

  1. Create a temp project: my_script_proj/

  2. Copy my_script.rs into src/lib.rs

  3. Generate Cargo.toml

  4. Run cargo test --doc

  5. Delete the project

  6. Print results to your terminal


๐Ÿ“ Example

Given math.rs:

  /// Add two numbers.
  ///
  /// ```
  /// use math_proj::add;
  /// assert_eq!(add(2, 3), 5);
  /// ```
  pub fn add<T: std::ops::Add<Output = T>>(a: T, b: T) -> T {
      a + b
  }

You can run the doctest:

runs math.rs

Versioning:

The version was increased from 0.1.1 to 0.1.2, because the fn keyword is made public in the src/lib.rs by runs. So, user doesn't have to do that on their own.