tarrball/shoulds

shoulds is a Shouldly-inspired test assertion library for testing Rust

shoulds

shoulds is a Shouldly-inspired test assertion library for testing Rust.

Current Assertions:

Equality

  • should_be
  • should_be_greater_than
  • should_be_greater_than_or_equal_to
  • should_be_less_than
  • should_be_less_than_or_equal_to

Strings

  • should_contain
  • should_not_contain

Booleans

  • should_be_false
  • should_be_true

Results

  • should_be_error
  • should_be_ok

I'll add more assertions along the way as the need arises.

Install:

Cargo.toml:

[dev-dependencies]
shoulds = "0.1.6"

Enjoy:

src/lib.rs:

fn add(a: i32, b: i32) -> i32 {
    a + b
}

fn concat(a: &String, b: &String) -> String {
    format!("{}{}", a, b)
}

#[cfg(test)]
mod tests {
    use crate::{add, concat};
    use shoulds::*;

    #[test]
    fn add_adds_params_together() {
        let result = add(40, 2);

        result.should_be(42)
    }

    #[test]
    fn concat_concats_strings_together() {
        let result = concat(&"Hello, ".to_string(), &"world!".to_string());

        result.should_be("Hello, world!".to_string());
    }
}
Issues

Collection of the latest Issues

Information - Updated Jul 13, 2022

Stars: 1
Forks: 0
Issues: 1

Repositories & Extras

utest standard testing for Rust

Make sure your not using this for testing no_std code as it relies on the unstable branch

utest standard testing for Rust

K9 - Rust Testing Library

Snapshot testing + better assertions

K9 - Rust Testing Library

Spec "it" for Rust testing

The test output is like the following

Spec "it" for Rust testing

Shuttle is a library for testing concurrent Rust code

It is an implementation of a number of

Shuttle is a library for testing concurrent Rust code

Let's make a web service and client in Rust

So I'm working on this project Rust regression testing

Let's make a web service and client in Rust

Simple golden file testing for Rust

Add the following to your Cargo manifest

Simple golden file testing for Rust
Http

329

HTTP mocking to test Rust applications

wiremock provides HTTP mocking to perform black-box testing of Rust applications that

HTTP mocking to test Rust applications

just testing rust

cli + advanced cli features

just testing rust

Testing Rust Code

This repo contains examples of many common features and approaches for testing here

Testing Rust Code
Facebook Instagram Twitter GitHub Dribbble
Privacy