[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: assert with formatting
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 13 Jul 2018 10:00:16 +0200
2018-07-13 0:52 GMT+02:00 <tobias@justdreams.de>:
>
> Hi there,
>
> working on unittests made me aware that having an assert function with
> formatting would be very helpful.
>
>> a=4
>> assert( a==1, '`a` should be `%d`, but was `%s`', 1, a )
>
>
> Of course I could write a wrapper function which takes varargs compiles the
> string and run assert on that.
assert( a==1, ('`a` should be `%d`, but was `%s`'):format(1,a) )