Robert
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
I think the error is that it can't find the include file. T
he compiler
has no search path for include files but they are only relative to the
current working directory. Unfortunately. Try compiling with:
> (c '"mst" '(verbose return))
./mst.lfe:5: error expanding (include-file (108 102 101 47 ...))
#(error
(#("./mst.lfe"
(#(5
lfe_macro
#(expand_macro
(include-file "lfe/include/match-sspec.lfe")
#(#(none file enoent) "lfe/include/match-sspec.lfe"))))))
())
and you should get a similar output which means it can't find the file
(the enoent). I have just pushed a patch to the develop branch which
outputs a little better macro error messages. The handling of
include-file and include-lib wrt search paths needs to be improved.
This is strange. Could you please send me the files and I will check
if there is some other error hiding in there and being shown as an
include-file error. Give me something to do on the flight, at least
until the battery runs out. :-)
I notice that the actual error is 'undef' which means a call to an
undefined module or function. I broke out the handling of the include
macro into a separate file lfe_macro_include.erl. You have compiled
this and it is in the right directory?
That definitely sounds like something for me. I will ger onto it when I get home.
Robert
From my Nexus
Thanks, Robert!
d
Try doing:
(include-lib "eunit/include/eunit.hrl")
It does not assume anything about the file name, so you have to give the .hrl as well (and the .lfe).
I did a quick check and it seems to work but it only defines the macros IF, EUNIT_HRL, _cmd_, EUNIT and TEST
which is not very useful. I will try and find out what is going on and see what I can do about it.
On Tue, May 14, 2013 at 5:56 PM, Robert Virding <rvir...@gmail.com> wrote:
Try doing:
(include-lib "eunit/include/eunit.hrl")
It does not assume anything about the file name, so you have to give the .hrl as well (and the .lfe).
Ah, good to know. I had tried all sorts of combinations, and none of them seemed to work. For instance:
$ ERL_LIBS=./deps/lfe:./deps/eredis:./ ./deps/lfe/bin/lfec -o ./.eunit test/*.lfe
test/ledis-api-tests.lfe: no such file or directory
test/ledis-client-tests.lfe: no such file or directory
I did a quick check and it seems to work but it only defines the macros IF, EUNIT_HRL, _cmd_, EUNIT and TEST
Ah, that sounds like a new trick I don't know in Erlang: how do you check to see what has been brought in to the current namespace by a compile, slurp, etc.? I half-remember something, but nothing here jogs my memory: http://www.erlang.org/doc/man/c.html ...
I did a quick check and it seems to work but it only defines the macros IF, EUNIT_HRL, _cmd_, EUNIT and TESTAh, that sounds like a new trick I don't know in Erlang: how do you check to see what has been brought in to the current namespace by a compile, slurp, etc.? I half-remember something, but nothing here jogs my memory: http://www.erlang.org/doc/man/c.html ...
I'm still curious about this one, though!
> (set filter-env (lambda (env) (: lists foreach (match-lambda (((tuple 'function func-name arity _)) (: io format '"function: ~p/~p~n" (list func-name arity))) (((tuple 'macro macro-name _)) (: io format '"macro: ~p~n" (list macro-name))) (((tuple 'variable var-name value)) (: io format '"variable: ~p~n" (list var-name))) ((_))) env)))> (funcall filter-env $ENV) variable: 'my-var-4' variable: 'my-var-3'
...
Update for folks who haven't been watching the repo: Robert has done a ton of additional work around includes and the subtleties of getting odd bits of eunit.hrl to work in LFE.Thanks again, Robert -- this is really great :-) I've been testing it out tonight for the first time, now that I'm back in town, and assert, assertNot, assertEqual, assertMatch, etc., all seem to be working as expected -- I'm so delighted! Also, I've been amazed that the line numbers are working too; that's a big bonus.All of this gets me to 90% of where I need to be, and will keep me busy (updating libraries, etc.) for a bit.However, as you might expect, I do have some questions :-)1) The include-lib doesn't work for me when I compile the unit tests. However, if I hop into the REPL, do a macroexpand on the .hrl file, and then re-run the unit tests, everything works. I'm guessing there's a step I need to take in the compile process, but I don't know what's going on behind the scenes that would explain this behaviour, so I wanted to ask you about it before I started hacking for a "fix" in my make targets :-)
2) I think this is related, and I'm pretty sure you've answered this before (sorry): when I include-lib the eunit.hrl in the REPL, I get an error. I can, however, macroexpand in the REPL. Is there any way to use the functions/macros defined by eunit.hrl in the REPL for testing? Or is that not possible right now?
3) Do I remember correctly that the (my_test_ () ... (_test ...)) and (my_test_ () ... (_assert* ...)) style tests (with the trailing underscore) aren't going to work in LFE? (When I tried, I got some errors... process-killed errors; but before I dug too deeply, I wanted to check with you.)
4) If my recollection for #3 is correct, then fixtures won't be supported either; I'm guessing I could add support via some custom LFE macros... any pointers that would get me started in the right direction?
Thanks again!!!
d
On Tuesday, May 14, 2013 7:56:18 PM UTC-5, rvirding wrote:Try doing:
(include-lib "eunit/include/eunit.hrl")
It does not assume anything about the file name, so you have to give the .hrl as well (and the .lfe).
I did a quick check and it seems to work but it only defines the macros IF, EUNIT_HRL, _cmd_, EUNIT and TEST which is not very useful. I will try and find out what is going on and see what I can do about it.
RobertOn 15 May 2013 02:34, Duncan McGreggor <dun...@cogitat.io> wrote:dThanks!(Perhaps the macros are too complex for what LFE does with .hrl files?)Possibly not related to your feature: I've tried compiling (with lfec) a very simple eunit .lfe file and I get this error:Is eunit not supported?
test/ledis-api-tests.lfe:4: error expanding (include-lib "eunit/include/eunit")
test/ledis-client-tests.lfe:4: error expanding (include-lib "eunit/include/eunit")
On Sat, Apr 6, 2013 at 9:48 PM, <dun...@cogitat.io> wrote:
Thanks, Robert!
d
On Wednesday, April 3, 2013 4:51:06 PM UTC-7, rvirding wrote:This has now been fixed for R16B and I have now pushed the fix onto the 'develop' branch. The cause of the problem was me being naughty and using an undocumented function to test file names, and the little ***s removing it in R16. Anyway it is now fixed. Let me know of more bugs.
Robert
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.