tcunit / TcUnit-Runner

Program that makes it possible to automate runs of TcUnit unit tests
Other
35 stars 17 forks source link

Parse error if assert message is empty #6

Closed stefanbesler closed 4 years ago

stefanbesler commented 4 years ago

Writing a Unitest that doesn't have an explicit message for an assert, results in a parsing error. I know, the message is useful, but can you default to a message if none is given explicitly? I don't think it should be necessary to give a detailed message. It'd prefer a simple default like "assertion failed, 5!=4" (if message is empty).

AssertEquals(5, 4, '');

results in

ERROR: While parsing TcUnit results, expected TEST_ASSERT_MESSAGE but got TEST_ASSERT_TYPE

when used together with TcUnit-Runner, no xml file is generated although other tests use explicit messages.

I am using TcUnit 1.1.0.0 TcUnit-Runner 0.9.1.0

sagatowski commented 4 years ago

Good catch! As you say, it should not be a requirement to have a message. I think the best way is to have the TcUnit-Runner either expect a test-assert-message OR the test-assert-type (in other words, no message needs to be provided).

sagatowski commented 4 years ago

@stefanbesler By the way, if you want and agree on the above suggestion, you're welcome to create a PR and I'll merge your changes in.

sagatowski commented 4 years ago

Solved in c554610e59811c60370b7bf2e385065652f94d65. Thanks @stefanbesler !