guydunton / rust-catch Goto Github PK
View Code? Open in Web Editor NEWA Rust port of the Catch unit-testing framework
License: MIT License
A Rust port of the Catch unit-testing framework
License: MIT License
See example below:
test_case!("test") {
// Get a warning that the variable is unused or doesn't
// need to be mutable.
let mut var = 4;
section!("sec1") {
// Use variable here
}
section!("sec2") {
// Don't use the variable here
}
}
This variable shouldn't be marked as unused/could be immutable.
Currently if you have duplicate test_case
names you will get an error pointing you to the test_suite!
macro rather than the duplicate names.
Instead both duplicate names should appear in the error message.
The program needs tests.
Possible ways of doing this include hooking in something custom for panics
I cannot add extra attributes to tests.
e.g. I should be able to write
#[should_panic]
test("this will panic") {
panic!();
}
We just need a new version of test_case called test because it's less verbose.
There isn’t any point having an empty test_suite so a warning should be provided explaining the syntax for a test case.
All code using the old names has been updated so the old version can be removed
There needs to be some documentation for the library to show how it should be used.
Currently when the docs are generated they only show the tests
and test_suite
macros.
This might also be a good opportunity to investigate rusts documentation tests as a replacement for a lot of the example code
Currently rust_gb is struggling with it's tests because I cannot wrap braces around a section e.g.
for (opcode, register) in instructions {
section("a logical test unit") {
}
}
Less typing is always good
Since section introduce a new scope this means that you cannot put code after a section relying on any variables within that section. This prevents common code being put after a section e.g.
test("My test") {
section("test for one thing") {
let result = myFunction();
}
section("test for a second thing") {
let result = myFunction(withParam);
}
assert_eq!(result, passed);
}
Currently the help for a blank name is: Hint: Try to use a descriptive name such as "Vec can be resized"
. But when you do this you will get a warning saying: function `Vec_can_be_resized` should have a snake case name
.
This warning should be suppressed.
When you have the code
test! {
test("My Test") {
section("my test name") {
// Actual test
}
}
}
This code will be translated into:
mod My_Test {
#[test]
fn my_test_name() {
// Actual test
}
}
It appears mod names are still warning about not being snake case
Need some automated CI to ensure library maintains quality
At the moment if you have an empty title in a section the entire test_suite is highlighted as being in error. It would be better if the error pointed to the empty name
In this issue I decided to suppress all warnings for unused variables and unused mutable.
I would like to have a more fine grained approach involving determining if a warning is valid e.g.
test_case!("test") {
let mut a = 4;
let name = "Michael";
section("check a") {
a += 1;
assert_eq!(a, 5);
}
section("is a the same") {
assert_eq!(a, 4);
}
}
In the above example we would like to see the warning for the unused variable because that variable has not been used in either section.
A way of doing this would be to check the warnings in the code and if a warning was present in one section but not another in the same test case, we suppress the warning.
In order to do this it might help to have the proc_macro_diagnostics.
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.