Closed NobbZ closed 5 years ago
What about doing something like this?
# test.exs
ExUnit.start(autorun: false)
ExUnit.configure(exclude: :pending, trace: true)
Code.require_file("two_fer.exs", __DIR__)
Code.require_file("two_fer_test.exs", __DIR__)
ExUnit.Server.modules_loaded()
ExUnit.run()
# two_fer_test.exs
defmodule TwoFerTest do
use ExUnit.Case
test "no name given" do
assert TwoFer.two_fer() == "One for you, one for me"
end
@tag :pending
test "a name given" do
assert TwoFer.two_fer("Gilberto Barros") == "One for Gilberto Barros, one for me"
end
# and so on...
end
Advantages:
> elixir test.exs
Disadvantages:
I have been doing a lot of reading about the auto-analyzer project that exercism is undertaking, and it might be useful to decouple these two aspects so that they can be used separately in an implementation.
Thoughts?
I'm not sure which one is the most appropriate, honestly. It seems like any of them will work and eval_file
is the simplest? I'm honestly more in favor of moving over to using mix projects for each exercise and this would be a good excuse to do so. @neenjaw's proposal is an interesting middle ground, but I think I'd still prefer to just move to mix projects.
I think this could be a first step though, we eliminate the problem when 1.9 drops, and then we can just transplant the test case to the proper location if/when/once we move to mix
Now resolved with PR #480
Code.load_file/2
as its used currently in the tests has been soft deprecated a year ago (elixir-lang/elixir#7201). It will be hard deprecated in elixir 1.9 and spit out warnings.Instead one of
Code.require_file/2
,Code.compile_file/2
, orCode.eval_file/2
should be used.