trompeloeil icon indicating copy to clipboard operation
trompeloeil copied to clipboard

Expression analysis in WITH caluse

Open ytimenkov opened this issue 7 years ago • 0 comments

Follow-up from #37

Boost.Test has a nice feature of analyzing expression in test clause essentially removing the need for specialized checks list xx_GT, xx_EQ, etc. This allows to write check expression in a natural way but at the same time gives usable messages when check fails. For example BOOST_TEST(sut.get_property() == "expected_value") produces message like:

test.cpp(123): error: in "test_suite/test_case": check sut.get_property() == "expected_value" has failed [not_expected != expected_value]

trompeloeils' WITH macro (or a version of it) could do similar analysis of expression to produce better failure messages.

Another thought is that when there is only one expectation set for a call, the output might be simplified to directly saying that expectation failed and why in one statement rather than split "no matching expectation" / "tried xxx" duo.

ytimenkov avatar Nov 15 '18 11:11 ytimenkov