lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi there,

working on unittests made me aware that having an assert function with formatting would be very helpful.

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. However, when hooking up to the debugger it will always report the assert in the helper function as a location instead of the location in the unittest which is broken. It's obviously still available in the
callstack, but it would be nicer the other way.

Just a thought, not sure how hard it would be.