[Proposal]: Make test created by `mix test` actually test the generated code

24 views
Skip to first unread message

Unai Esteibar Caballero

unread,
May 27, 2017, 6:23:09 AM5/27/17
to elixir-lang-core
Hi there!

I've modified my fork of the elixir repo so when you run `mix new my_project` it creates the following test:

defmodule MyProjectTest do
  use ExUnit.Case
  doctest MyProject

  test "salutates the world" do
    assert MyProject.hello == :world
  end
end

the current behaviour is:

test "the truth" do
  assert 1 + 1 == 2
end

which doesn't actually test the code.

My motivation for this change is that we would want the developers to be either consciously testing or not the code.
This change would push you towards this goal by giving you a red build whenever you changed the code for the first time, leading you to explicitly make the decision of fixing your tests to align with the changes you introduced to the code or consciously decide to remove them.


What do you guys think about this proposal? If it's fine for you, I can create an issue with the explanation and a pull request with the code I linked to above.

Thank you!!

Unai Esteibar

José Valim

unread,
May 27, 2017, 6:32:40 AM5/27/17
to elixir-l...@googlegroups.com
Please do send a PR! I do believe this is better than the current code.
--


José Valim
Skype: jv.ptec
Founder and Director of R&D

Unai Esteibar Caballero

unread,
May 27, 2017, 8:09:55 AM5/27/17
to elixir-lang-core, jose....@plataformatec.com.br
Done! Thanks for the quick reply :)
Reply all
Reply to author
Forward
0 new messages