dojo-toulouse / elixir-koans

Small exercises to discover elixir by testing
249 stars 61 forks source link

Using "think" instead of "test" in about_named_function causes errors #10

Closed real34 closed 9 years ago

real34 commented 10 years ago

There is a problem with scopes when using think in a test which needs to access methods defined externally.

For instance in about_name_function.exs replacing think with test for the first test causes the following error:

** (CompileError) about_named_function.exs:10: function hello/1 undefined
    src/elixir_translator.erl:40: :elixir_translator.translate_each/2
    lists.erl:1339: :lists.mapfoldl/3
    src/elixir_translator.erl:58: :elixir_translator.translate_each/2
    about_named_function.exs:10: About_Named_Functions (module)
    about_named_function.exs:9: About_Named_Functions (module)

After searching I found Module.eval_quoted which may be a solution, but I could not make it work.

Tested on Elixir v0.11.3-dev