Vladimir Pouzanov
2014-07-22 19:06:37 UTC
I've just published a tiny test framework: shiny at
https://github.com/farcaller/shiny. It's best used with hamcrest-rust.
This library exists because I find it ugly to redefine all the
initialisation code in every test case and I can't simply move it to a
function due to problems with moving [T] out.
Here's how shiny looks:
#[cfg(test)]
mod test {
describe!(
before_each {
let awesome = true;
}
it "is awesome" {
assert!(awesome);
}
it "injects before_each into all test cases" {
let still_awesome = awesome;
assert!(still_awesome);
}
)
}
https://github.com/farcaller/shiny. It's best used with hamcrest-rust.
This library exists because I find it ugly to redefine all the
initialisation code in every test case and I can't simply move it to a
function due to problems with moving [T] out.
Here's how shiny looks:
#[cfg(test)]
mod test {
describe!(
before_each {
let awesome = true;
}
it "is awesome" {
assert!(awesome);
}
it "injects before_each into all test cases" {
let still_awesome = awesome;
assert!(still_awesome);
}
)
}
--
Sincerely,
Vladimir "Farcaller" Pouzanov
http://farcaller.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140722/102ee849/attachment.html>
Sincerely,
Vladimir "Farcaller" Pouzanov
http://farcaller.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140722/102ee849/attachment.html>