latte 0.1.2

Macro crate that expands Mocha syntax to standard Rust syntax
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 0 items with examples
  • Size
  • Source code size: 2.99 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • jakeec/latte
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jakeec

Latte

Ever wanted Mocha's describe/it syntax in Rust? No? Well here it is anyway! This crate simply contains two macros describe! and it! that expand into Rust's native test constructs.

Example

describe!(test_suite, {
    it!(does_something, {
        assert_eq!(1, 1);
    });

    it!(does_something_else, {
        assert!(false);
    });
});

Is equivalent to

#[cfg(test)]
mod test_suite {
    #[test]
    fn does_something() {
        assert_eq!(1, 1);
    }

    #[test]
    fn does_something_else() {
        assert!(false);
    }
}

Setup

Install the crate by adding latte to your Cargo.toml's dependencies and then simply add this import to your code:

#[macro_use]
extern crate latte;

Purpose

There really is no purpose to this. It's arguably a bit easier to read because you don't have a bunch of attributes cluttering up the place, but ultimately this was just an exercise to learn the basics of macro_rules!. If you do happen to find this library somewhat useful and would like to see some features added, let me know on GitHub or submit a pull request.