Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/k-nasa/ruspec
write like Rspec testing framework with rust
https://github.com/k-nasa/ruspec
rspec rust test testing testing-framework
Last synced: 29 days ago
JSON representation
write like Rspec testing framework with rust
- Host: GitHub
- URL: https://github.com/k-nasa/ruspec
- Owner: k-nasa
- License: mit
- Created: 2019-03-11T09:48:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-26T20:57:42.000Z (over 1 year ago)
- Last Synced: 2024-09-27T12:01:35.486Z (about 1 month ago)
- Topics: rspec, rust, test, testing, testing-framework
- Language: Rust
- Homepage:
- Size: 63.5 KB
- Stars: 24
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ruspec - write like Rspec testing framework with rust
[![crate-name at crates.io](https://img.shields.io/crates/v/ruspec.svg)](https://crates.io/crates/ruspec)
## how to use
Add your Cargo.toml
```
ruspec = "0.1.3"
```import ruspec!
```
use ruspec::ruspec;
```## Example syntax
```rust
use ruspec::ruspec;ruspec! {
describe "test module name" {
before { let context = 5; }
subject { context + 5 }it "test name" {
assert_eq!(subject, 10);
}
}describe "test module 2" {
before { let context = 5; }
it "test name" {
assert_eq!(context, 5);
}context "context is 6" {
before { let context = 6; }
it "should equal 6" {
assert_eq!(context, 6);
}
}
}
}// # Expand
mod test_module_name {
#[test]
fn test_name() {
let context = 5;assert_eq(context + 5, 10)
}
}mod test_module_2 {
#[test]
fn test_name() {
let context = 5;assert_eq(context, 10)
}mod context_is_6 {
#[test]
fn should_equal_6() {
let context = 6;
assert_eq!(context, 6)
}
}
}
```