Re: fluent-asserts released

2017-04-18 Thread Szabo Bogdan via Digitalmars-d-announce

On Wednesday, 12 April 2017 at 06:22:26 UTC, Ali Çehreli wrote:

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


Hi!

I managed to make another update to the library.

http://fluentasserts.szabobogdan.com/

Based on your feedback I updated the exception asserts and I 
added some new ones

like `Between` and `Approximately`.

Also now it works with unit-threaded.

Thanks for the feedback!





Re: fluent-asserts released

2017-04-11 Thread Ali Çehreli via Digitalmars-d-announce

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



Re: fluent-asserts released

2017-04-11 Thread Szabo Bogdan via Digitalmars-d-announce

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?






Re: fluent-asserts released

2017-04-11 Thread qznc via Digitalmars-d-announce

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");
});


Re: fluent-asserts released

2017-04-11 Thread Jacob Carlborg via Digitalmars-d-announce

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


Re: fluent-asserts released

2017-04-10 Thread Atila Neves via Digitalmars-d-announce

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


Re: fluent-asserts released

2017-04-10 Thread Szabo Bogdan via Digitalmars-d-announce

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.


Re: fluent-asserts released

2017-04-10 Thread jmh530 via Digitalmars-d-announce

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.


Re: fluent-asserts released

2017-04-10 Thread Szabo Bogdan via Digitalmars-d-announce

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


Re: fluent-asserts released

2017-04-10 Thread Jacob Carlborg via Digitalmars-d-announce

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


fluent-asserts released

2017-04-09 Thread Szabo Bogdan via Digitalmars-d-announce

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!