Crates.io | qutonium |
lib.rs | qutonium |
version | 0.1.6 |
source | src |
created_at | 2020-10-05 17:17:45.327107 |
updated_at | 2020-11-17 18:12:52.030181 |
description | simplify unit testing with a functional testing framework đ |
homepage | https://github.com/qurity |
repository | https://github.com/qurity/qutonium |
max_upload_size | |
id | 296375 |
size | 38,553 |
simplify unit testing with a minimal testing framework đ
qutonium is takes is inspiration from the rust-testing-microframework. the goal is to provide a minimal testing framework for assertions (see the list of features here). the project is still in work in progress so.. DO NOT USE IN PRODUCTION. DO NOT USE IN PRODUCTION. DO NOT USE IN PRODUCTION. feedbacks appreciated!
more examples here
basic syntax
fn main () {}
#[cfg(test)]
mod tests {
extern crate qutonium;
use qutonium::prelude::*;
#[test]
fn from_test () {
suite!("the suite case name ~basic", {
"compare integer" || {
expect!(2 + 2).to(be_equal(4));
}
});
}
}
sugar syntax
fn main () {}
#[cfg(test)]
mod tests {
extern crate qutonium;
use qutonium::prelude::*;
#[test]
fn from_test () {
suite!("the suite case name ~sugar", {
"compare integer" || {
must!(2 + 2; be 4);
}
});
}
}
stdout
The output format follow the syntax from crystal
| ruby
. s/o Siegfried Ehret
SUITE the suite case name
TEST compare integer (0ms)
ERROR
đ received: <0> expected: <1>
đ src/main.rs:7:7
END
END
TEST compare boolean (0ms)
SUCCESS
đ ok
đ src/main.rs:12:7
END
END
TEST testing should panic (0ms)
SUCCESS
đ ok
đ src/main.rs:16:7
END
END
END
DIAGNOSTIC
đ failed: 1 đ passed: 2 đ total: 3
END
Add the following to your Cargo.toml:
[dependencies]
qutonium = "0.1.3"
suite!
expect
not
& to
matchers
| see the complete list herematchers
matchers
location
snapshot
diff | using differences cratematchers
before:all
, before:each
, after:all
and after:each
json
, xml
| generic execution format for sonar (xml only)skip
and only
store
| state containerpanic
can be testingjson
handler | snippet |
---|---|
to_json | see more informations about the export here |
marker | snippet |
---|---|
to | expect!(expr).to(matcher) |
not | expect!(expr).not(matcher) |
boolean
matcher | snippet |
---|---|
be_false | expect!(expr).to(be_false()) |
be_true | expect!(expr).to(be_true()) |
common
matcher | snippet |
---|---|
be_equal | expect!(expr).to(be_equal(expr)) |
Copyright Šī¸ 2020 Qurity
Released under the MIT license