How to override EUNIT_DEBUG_VAL_DEPTH macro?

On this page under the description for debugVal there is a part that says:

Large terms are truncated to the depth given by the macro EUNIT_DEBUG_VAL_DEPTH, which defaults to 15 but can be overridden by the user.

This is great, because I think 15 is too short, but I can’t figure out how to actually change this macro.

I’ve tried injecting -define(EUNIT_DEBUG_VAL_DEPTH, 50). in my code, but this just prompts a compiler error: redefining macro 'EUNIT_DEBUG_VAL_DEPTH'

How can I override this value? Can I do it using rebar3,?

1 Like

You supply it while compiling. For erlc this would be the parameter -DEUNIT_DEBUG_VAL_DEPTH=50. For rebar3, you can add the following line to your rebar.config, to change it:

{eunit_compile_opts, [{d, 'EUNIT_DEBUG_VAL_DEPTH', 50}]}.

Does this help?

3 Likes

That makes perfect sense. Thanks!

1 Like