Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 09, 2017 fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Hi! I just made an update to my fluent assert library. This is a library that allows you to write asserts in a BDD style. Right now, it contains only asserts that I needed in my projects and I promise that I will add more in the future. I would really appreciate any feedback that you can give me. https://code.dlang.org/packages/fluent-asserts Thanks! |
April 10, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szabo Bogdan | On 2017-04-09 15:30, Szabo Bogdan wrote: > Hi! > > I just made an update to my fluent assert library. This is a library > that allows you to write asserts in a BDD style. > > Right now, it contains only asserts that I needed in my projects and I > promise that I will add more in the future. > > I would really appreciate any feedback that you can give me. > > https://code.dlang.org/packages/fluent-asserts This looks awesome. Why haven't I seen that before. Can it be used with unit-threaded? -- /Jacob Carlborg |
April 10, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Monday, 10 April 2017 at 12:54:43 UTC, Jacob Carlborg wrote:
> On 2017-04-09 15:30, Szabo Bogdan wrote:
>> Hi!
>>
>> I just made an update to my fluent assert library. This is a library
>> that allows you to write asserts in a BDD style.
>>
>> Right now, it contains only asserts that I needed in my projects and I
>> promise that I will add more in the future.
>>
>> I would really appreciate any feedback that you can give me.
>>
>> https://code.dlang.org/packages/fluent-asserts
>
> This looks awesome. Why haven't I seen that before. Can it be used with unit-threaded?
I did not tested it with unit-threaded, but when an assert fails it throws an exception so it should work with any test runner
|
April 10, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szabo Bogdan | On Sunday, 9 April 2017 at 13:30:54 UTC, Szabo Bogdan wrote:
> Hi!
>
> I just made an update to my fluent assert library. This is a library that allows you to write asserts in a BDD style.
>
> Right now, it contains only asserts that I needed in my projects and I promise that I will add more in the future.
>
> I would really appreciate any feedback that you can give me.
>
> https://code.dlang.org/packages/fluent-asserts
>
> Thanks!
I got really confused looking at the examples until I realized that should returns a struct.
You might add an approxEqual for ShouldNumeric. If you have floating point numbers, it's usually more helpful than equal is.
|
April 10, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmh530 | On Monday, 10 April 2017 at 17:38:14 UTC, jmh530 wrote:
> On Sunday, 9 April 2017 at 13:30:54 UTC, Szabo Bogdan wrote:
>> Hi!
>>
>> I just made an update to my fluent assert library. This is a library that allows you to write asserts in a BDD style.
>>
>> Right now, it contains only asserts that I needed in my projects and I promise that I will add more in the future.
>>
>> I would really appreciate any feedback that you can give me.
>>
>> https://code.dlang.org/packages/fluent-asserts
>>
>> Thanks!
>
> I got really confused looking at the examples until I realized that should returns a struct.
>
> You might add an approxEqual for ShouldNumeric. If you have floating point numbers, it's usually more helpful than equal is.
thanks! I added 2 issues for your sugestion. I also found some bugs that I will fix in the next release.
|
April 10, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szabo Bogdan | On Monday, 10 April 2017 at 14:15:45 UTC, Szabo Bogdan wrote: > On Monday, 10 April 2017 at 12:54:43 UTC, Jacob Carlborg wrote: >> On 2017-04-09 15:30, Szabo Bogdan wrote: >>> Hi! >>> >>> I just made an update to my fluent assert library. This is a library >>> that allows you to write asserts in a BDD style. >>> >>> Right now, it contains only asserts that I needed in my projects and I >>> promise that I will add more in the future. >>> >>> I would really appreciate any feedback that you can give me. >>> >>> https://code.dlang.org/packages/fluent-asserts >> >> This looks awesome. Why haven't I seen that before. Can it be used with unit-threaded? > > I did not tested it with unit-threaded, but when an assert fails it throws an exception so it should work with any test runner It'll work, but it won't end up reporting it the same way. If you'd like that to work seamlessly it's a question of having `version(Have_unit_threaded)` (or however it is it's spelled) that imports and throws `unit_threaded.should.UnitTestException`. Then Bob's your uncle. Atila |
April 11, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | On 2017-04-10 22:41, Atila Neves wrote: > It'll work, but it won't end up reporting it the same way. If you'd like > that to work seamlessly it's a question of having > `version(Have_unit_threaded)` (or however it is it's spelled) that > imports and throws `unit_threaded.should.UnitTestException`. Then Bob's > your uncle. Ok, I see, thanks. On the other hand I just remembered that unit-threaded already have a very similar API for the assertions. -- /Jacob Carlborg |
April 11, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szabo Bogdan | On Sunday, 9 April 2017 at 13:30:54 UTC, Szabo Bogdan wrote:
> Hi!
>
> I just made an update to my fluent assert library. This is a library that allows you to write asserts in a BDD style.
>
> Right now, it contains only asserts that I needed in my projects and I promise that I will add more in the future.
>
> I would really appreciate any feedback that you can give me.
>
> https://code.dlang.org/packages/fluent-asserts
>
> Thanks!
I was looking for testing exceptions. It is not documented, but the seems to be there. Still, it looks weird, because it does not fit the style:
should.not.throwAnyException({
throw new Exception("test");
});
|
April 12, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to qznc | On Tuesday, 11 April 2017 at 10:40:53 UTC, qznc wrote: > On Sunday, 9 April 2017 at 13:30:54 UTC, Szabo Bogdan wrote: >> Hi! >> >> I just made an update to my fluent assert library. This is a library that allows you to write asserts in a BDD style. >> >> Right now, it contains only asserts that I needed in my projects and I promise that I will add more in the future. >> >> I would really appreciate any feedback that you can give me. >> >> https://code.dlang.org/packages/fluent-asserts >> >> Thanks! > > I was looking for testing exceptions. It is not documented, but the seems to be there. Still, it looks weird, because it does not fit the style: > > should.not.throwAnyException({ > throw new Exception("test"); > }); what do you mean, they are not documented? there is a md file fith some examples here: https://github.com/gedaiu/fluent-asserts/blob/v0.3.0/api/exceptions.md What do you think I can do to have the exception asserts to fit the style? |
April 11, 2017 Re: fluent-asserts released | ||||
---|---|---|---|---|
| ||||
Posted in reply to Szabo Bogdan | On 04/11/2017 11:01 PM, Szabo Bogdan wrote: >> >> should.not.throwAnyException({ >> throw new Exception("test"); >> }); > > what do you mean, they are not documented? there is a md file fith some > examples here: > https://github.com/gedaiu/fluent-asserts/blob/v0.3.0/api/exceptions.md > > What do you think I can do to have the exception asserts to fit the style? The expression comes first in the other use cases. The following is not very pretty but seems to work with my proof of concept below: ({ throw new Exception("test"); }()).should.not.throwAnyException(); I checked the syntax with the following code: struct Should { Should not() { return this; } Should throwAnyException() { return this; } } Should should(E)(lazy E expr) { return Should(); } void main() { ({ throw new Exception("test"); }()).should.not.throwAnyException(); } Ali |
Copyright © 1999-2021 by the D Language Foundation