dzejkop / catchr Goto Github PK
View Code? Open in Web Editor NEWA testing framework for Rust inspired by Catch!
License: MIT License
A testing framework for Rust inspired by Catch!
License: MIT License
Right now this code
describe! {
case "one" {
case "two" {
case "three" {
assert!(true);
}
}
}
}
expands to
mod one {
use super::*;
mod two {
use super::*;
#[test]
fn three() {
{ { { { assert!(true); } } } }
}
}
}
Ideally we'd want
mod one {
use super::*;
mod two {
use super::*;
#[test]
fn three() {
assert!(true);
}
}
}
Syntax:
section "whatever" {
each msg in ["Hello", "World"] {
then "should be true" {
assert!(false, msg);
}
}
}
Should expand into
mod section_whatever {
use super::*;
mod msg_is_hello {
use super::*;
#[test]
fn then_should_be_true() {
{
let msg = "Hello";
assert!(false, msg);
}
}
}
mod msg_is_world {
use super::*;
#[test]
fn then_should_be_true() {
{
let msg = "World";
assert!(false, msg);
}
}
}
}
Notes:
each item in items
item
should be a pattern and items
a list of pattern.Catch does this
Scenario: vectors can be sized and resized
Given: A vector with some items
When: more capacity is reserved
Then: the capacity changes but not the size
catchr
will show you the path to the test, but paths cannot contain any special characters. It'd be nice to be able to do something like:
section "Very descriptive comment" {
case "-- special chars ???" {
assert!(false, catchr_msg!());
}
}
and for it to output:
running 1 test
test very_descriptive_comment::special_chars ... FAILED
failures:
---- very_descriptive_comment::special_chars stdout ----
thread 'very_descriptive_comment::special_chars' panicked at '
Section: Very descriptive comment
Case: -- special chars ???
', src/lib.rs:4:9
or something simmilar
Currently the catchr uses #[test] to mark tests.
Which is good for usual tests, but async is so contagious that even tests are affected.
For async code (with tokio in my case) common way is to use #[tokio::test] instead of #[test] (and other runtimes have similar, eg actix_rt::test).
Can we have support for that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.