[rust-dev] A shiny test framework

Nat Pryce nat.pryce at gmail.com
Wed Jul 23 04:18:01 PDT 2014


Could you use RAII to call a lambda?


On 22 July 2014 20:31, Vladimir Pouzanov <farcaller at gmail.com> wrote:

> One note on why there's no after_each:
>
> You cannot really make sure that the epilogue is being called, so if you
> need to do anything after your test case, use RAII in before_each.
>
>
> On Tue, Jul 22, 2014 at 8:10 PM, Benjamin Gudehus <hastebrot at gmail.com>
> wrote:
>
>> Nice to see an RSpec-like test framework and Hamcrest assertions/matchers
>> for Rust!
>>
>>
>> On Tue, Jul 22, 2014 at 9:09 PM, Ilya Dmitrichenko <
>> errordeveloper at gmail.com> wrote:
>>
>>> Dude, that's pretty much rspec ;) sweet!
>>> On 22 Jul 2014 20:07, "Vladimir Pouzanov" <farcaller at gmail.com> wrote:
>>>
>>>> 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);
>>>>     }
>>>>   )
>>>> }
>>>>
>>>> --
>>>> Sincerely,
>>>> Vladimir "Farcaller" Pouzanov
>>>> http://farcaller.net/
>>>>
>>>> _______________________________________________
>>>> Rust-dev mailing list
>>>> Rust-dev at mozilla.org
>>>> https://mail.mozilla.org/listinfo/rust-dev
>>>>
>>>>
>>> _______________________________________________
>>> Rust-dev mailing list
>>> Rust-dev at mozilla.org
>>> https://mail.mozilla.org/listinfo/rust-dev
>>>
>>>
>>
>
>
> --
> Sincerely,
> Vladimir "Farcaller" Pouzanov
> http://farcaller.net/
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
>


-- 
http://www.natpryce.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140723/589e9537/attachment.html>


More information about the Rust-dev mailing list