ltest icon indicating copy to clipboard operation
ltest copied to clipboard

Create assertion error records

Open oubiwann opened this issue 5 years ago • 2 comments

There are places in ltest that have to do some very ugly destructuring:

  • https://github.com/lfex/ltest/blob/ff9d44e312c82af7a7096689e435c7567eeb1f71/src/ltest.lfe#L146

This is due to Erlang having some pretty ugly (also probably quite old) error-creation for assertions, e.g.:

  • https://github.com/erlang/otp/blob/d6285b0a347b9489ce939511ee9a979acd868f71/lib/stdlib/include/assert.hrl#L298

Let's create some records (just the ones that are necessary) to at least keep our code clean.

These are going to need LOTS OF TESTS.

oubiwann avatar Aug 15 '20 22:08 oubiwann

This will show other similar ugly spots: git grep ',_ ,_' (all in the listener code).

Two of these are errors.

One is an ok.

Four are descriptions of ebins / modules.

One is test data.

These could all use some records ...

oubiwann avatar Aug 17 '20 05:08 oubiwann

I'm not 100% convinced about the usefulness of this, really ...

In theory, sounds great, but in practice, I'm not sure it would be used much. Maybe in one or two places with little impact?

oubiwann avatar Oct 15 '20 05:10 oubiwann