3个版本
| 0.1.2 | 2020年2月6日 | 
|---|---|
| 0.1.1 | 2020年2月6日 | 
| 0.1.0 | 2020年2月6日 | 
#464 in 测试
3KB
Latte
是否一直想要在Rust中使用Mocha的describe/it语法?不需要?不过这里还是有了!这个crate仅仅包含两个宏 describe! 和 it!,它们会被扩展为Rust的本地测试结构。
示例
describe!(test_suite, {
    it!(does_something, {
        assert_eq!(1, 1);
    });
    it!(does_something_else, {
        assert!(false);
    });
});
等同于
#[cfg(test)]
mod test_suite {
    #[test]
    fn does_something() {
        assert_eq!(1, 1);
    }
    #[test]
    fn does_something_else() {
        assert!(false);
    }
}
设置
通过在Cargo.toml的依赖中添加latte来安装这个crate,然后在您的代码中添加此导入
#[macro_use]
extern crate latte;
目的
这实际上没有任何目的。这可能是更容易阅读的,因为你没有一大堆属性弄乱地方,但最终这只是一个学习macro_rules!基础的练习。如果您发现这个库有点有用,并希望看到一些新功能,请告诉我GitHub或提交一个pull request。