All Projects → murarth → assert_matches

murarth / assert_matches

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Provides macro `assert_matches` for testing pattern matching

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to assert matches

Testify
A unit testing framework written in bash for bash scripts
Stars: ✭ 45 (-11.76%)
Mutual labels:  assert
Swiftpowerassert
Power Assert in Swift. Provides descriptive assertion messages.
Stars: ✭ 191 (+274.51%)
Mutual labels:  assert
ruling
Stateless rule engine
Stars: ✭ 19 (-62.75%)
Mutual labels:  assert
Expect More
Curried Type Testing library, and Test Matchers for Jest
Stars: ✭ 124 (+143.14%)
Mutual labels:  assert
Ppk assert
PPK_ASSERT is a cross platform drop-in & self-contained C++ assertion library
Stars: ✭ 164 (+221.57%)
Mutual labels:  assert
Gotest.tools
A collection of packages to augment the go testing package and support common patterns.
Stars: ✭ 205 (+301.96%)
Mutual labels:  assert
Baloo
Expressive end-to-end HTTP API testing made easy in Go
Stars: ✭ 702 (+1276.47%)
Mutual labels:  assert
coderbyte-challenges
ES 6/7 Javascript w/ Node - Coderbyte: tests-assert w/ working example
Stars: ✭ 1 (-98.04%)
Mutual labels:  assert
Debug assert
Simple, flexible and modular assertion macro.
Stars: ✭ 181 (+254.9%)
Mutual labels:  assert
chai-exclude
Exclude keys to compare from a deep equal operation with chai expect or assert.
Stars: ✭ 33 (-35.29%)
Mutual labels:  assert
Gopwt
PowerAssert library for golang
Stars: ✭ 137 (+168.63%)
Mutual labels:  assert
Resumable Assert
Assert replacement to continue execution in debugger
Stars: ✭ 157 (+207.84%)
Mutual labels:  assert
Check Types.js
MOVED TO GITLAB
Stars: ✭ 232 (+354.9%)
Mutual labels:  assert
Assert
A collection of convenient assertions for Swift testing
Stars: ✭ 69 (+35.29%)
Mutual labels:  assert
assert-never
Helper function for exhaustive checks of discriminated unions in TypeScript
Stars: ✭ 32 (-37.25%)
Mutual labels:  assert
Regex Assert Symfony
Common Regex to use with Assert in Symfony's entity
Stars: ✭ 5 (-90.2%)
Mutual labels:  assert
Power assert ex
Power Assert in Elixir. Shows evaluation results each expression.
Stars: ✭ 201 (+294.12%)
Mutual labels:  assert
phpstan-webmozart-assert
PHPStan extension for webmozart/assert
Stars: ✭ 132 (+158.82%)
Mutual labels:  assert
assert
Go 语言 assert 断言函数
Stars: ✭ 17 (-66.67%)
Mutual labels:  assert
Power Assert
Power Assert in JavaScript. Provides descriptive assertion messages through standard assert interface. No API is the best API.
Stars: ✭ 2,704 (+5201.96%)
Mutual labels:  assert

assert_matches

Provides a macro, assert_matches, which tests whether a value matches a given pattern, causing a panic if the match fails.

Documentation

#[macro_use] extern crate assert_matches;

#[derive(Debug)]
enum Foo {
    A(i32),
    B(i32),
}

let a = Foo::A(1);

assert_matches!(a, Foo::A(_));

assert_matches!(a, Foo::A(i) if i > 0);

To include in your project, only when tests are compiled, add the following to your Cargo.toml:

[dev-dependencies]
assert_matches = "1.5"

And add the following to your crate root:

#[cfg(test)] #[macro_use]
extern crate assert_matches;

License

assert_matches is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].