fluent-asserts released

Ali Çehreli via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Apr 11 23:22:26 PDT 2017


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



More information about the Digitalmars-d-announce mailing list