[erlang-questions] eunit failure - "*** test module not found ***"

Graeme Defty graeme.defty@REDACTED
Wed Mar 17 08:42:31 CET 2010


Mike,

Brilliant!

...and almost exactly right, except that 'true' is not the result of a
macro but literally the last line of code.

It comes about because of the old "Why cant I have a null function
call?" (AKA "Why cant I add in the extra ';'?") issue.

I have read the history on this one, and come down firmly on the side
that says this little bit of syntactic sugar would NOT in fact bring
about the end of the world as we know it. It iss the one thing about
erlang which causes me physical pain. Virtually every time I edit a
module, the first compilation throws up one or more syntax errors due
to missing/surplus commas/semi-colons. I would guess that it adds
about 25% to my erlang development time.

My work-around (for test functions, where I dont care about the
result) is to add a 'true' as the last line so that all my real tests
can have a comma on the end and I can duplicate/re-order them at will
without incurring the wrath of the syntax gods. In the case of a
generator function of course . . .

I had a feeling it would be something dopey, but am pleased to find
that the root cause is not MY dopeyness (IMHO - your mileage may vary)

Anyway, thanks again to all for the help.

Graeme

On 17 March 2010 00:39, French, Mike <Mike.French@REDACTED> wrote:
>
> Graeme,
>
> I think this occurs when you omit a leading underscore
> on an eunit macro in a test-generating function.
>
> For example, say you write a simple test function using a basic macro:
>
>  basic_test() -> ?assert( 1 + 1 =:= 2 ).
>
> Then you decide to convert it to a test-generating function, you should
> append  an '_' to the function name, and
> prepend an '_' to the macro    name:
>
>  fancy_test_() -> ?_assert( 1 + 1 =:= 2 ).
>
> but if you forget to change the macro name:
>
>  bad_test_() -> ?assert( 1 + 1 =:= 2 ).
>
> then you get the error as you describe:
>
>  undefined
>  *** test module not found ***
>  ::ok
>  =======================================================
>    Failed: 0.  Skipped: 0.  Passed: 0.
>  One or more tests were cancelled.
>  error
>
> The 'ok' value in the error message is the result of
> evaluating the function returned by the macro,
> so your mistake is on a macro that returns 'true'.
>
> Mike
>
>
>
>
>
>> -----Original Message-----
>> From: erlang-questions@REDACTED
>> [mailto:erlang-questions@REDACTED]On
>> Behalf Of Graeme Defty
>> Sent: 16 March 2010 15:34
>> To: erlang-questions@REDACTED
>> Subject: [erlang-questions] eunit failure - "*** test module not found
>> ***"
>>
>>
>> Hi,
>>
>> I have a problem executing eunit tests in my current environment
>> (which i am sure used to work fine - I think - curse this
>> failing memory :-(  )
>>
>> Anyway, I have included eunit in my source:
>>
>>  -include_lib("eunit/include/eunit.hrl").
>>
>> and it compiles without complaint, but when i try to run the
>> tests it fails:
>>
>>  4> eunit:test(csv).
>>  undefined
>>  *** test module not found ***
>>  ::true
>>
>>  =======================================================
>>    Failed: 0.  Skipped: 0.  Passed: 0.
>>  One or more tests were canceled.
>>  error
>>
>> I can see the auto-generated test functions using module_info/0 and
>> can even execute them manually.
>>
>> I am clearly not accessing a library, and I am sure I have missed some
>> simple step ( a parameter to the erl
>> command perhaps?) or something equally dumb, but i have scoured the
>> docs and cant find it.
>>
>> Any ideas, anyone?
>>
>> Thanks
>>
>> graeme
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
>
> Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail
> is confidential. It may also be legally privileged. It is intended only for
> the stated addressee(s) and access to it by any other person is
> unauthorised. If you are not an addressee, you must not disclose, copy,
> circulate or in any other way use or rely on the information contained in
> this e-mail. Such unauthorised use may be unlawful. We may monitor all
> e-mail communications through our networks. If you have received this e-mail
> in error, please inform us immediately on sender's telephone number above
> and delete it and all copies from your system. We accept no responsibility
> for changes to any e-mail which occur after it has been sent.  Attachments
> to this e-mail may contain software viruses which could damage your system.
> We therefore recommend you virus-check all attachments before opening.
> Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business
> Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No.
> 868273
>


More information about the erlang-questions mailing list