obmarg / ex_unit_fixtures

A library for defining modular dependencies (fixtures) for ExUnit tests.
MIT License
13 stars 5 forks source link

It's too easy to not use `@tag` and get wierd errors #37

Open obmarg opened 8 years ago

obmarg commented 8 years ago

I was just trying to use a fixture, and accidentally wrote:

@fixtures [:metainfo]
test "blah" do
end

instead of using @tag fixtures: [:metainfo]. And got this wierd error message:

** (ArgumentError) argument error
    :erlang.apply([:metainfo], :name, [])
    anonymous fn/3 in ExUnitFixtures.Imp.Preprocessing.resolve_dependencies/2
    (elixir) lib/enum.ex:1473: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/ex_unit_fixtures/imp/preprocessing.ex:65: ExUnitFixtures.Imp.Preprocessing.resolve_dependencies/2
    lib/ex_unit_fixtures/imp/preprocessing.ex:41: ExUnitFixtures.Imp.Preprocessing.preprocess_fixtures/2
    (stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:877: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:404: :erl_eval.expr/5

Which took me surprisingly long to figure out. I wrote this project and I'm making this mistake, so that's not good. Need to find a way to make things less error prone (or explain things better if making them error prone)

obmarg commented 8 years ago

Might be good to remove the reliance on module attributes for defining fixtures, which I think would prevent this somewhat. Not sure though.

obmarg commented 8 years ago

42 could maybe help with this.

NorthIsUp commented 5 years ago

48