Skip to content

Conversation

ericentin
Copy link
Contributor

As per #4159:

  • Adds :type field that defaults to :test to ExUnit.Test struct
  • Adds ExUnit.plural_rule/{1,2} and tests
  • Group ExUnit.Test completions by :type for display in
    ExUnit.CLIFormatter

This PR also includes a separate commit that implements what might be a good interface for setting the type of a test (based on a new tag :type for tests), and tests for the ExUnit.CLIFormatter display for tests with a non-:test :type.

If that interface doesn't work for us for whatever reason, I can back that out and whenever we do come up with an appropriate interface it can be added to the initial commit with updated tests that use the final interface.

ericentin added 3 commits May 16, 2016 15:53
  * Adds `:type` field that defaults to `:test` to `ExUnit.Test` struct

  * Adds `ExUnit.plural_rule/{1,2}`

  * Group `ExUnit.Test` completions by `:type` for display in
    `ExUnit.CLIFormatter`
@ericentin
Copy link
Contributor Author

Ok, didn't notice this since I was only running the ex_unit tests, but looks like an iex test is relying on ExUnit not having any specs in it to test IEx.Helpers.s/1. Defining an empty module inline for the test didn't work due to the debug info not being present (or something like that). I changed that to IEx.Remsh which looks like a good candidate to have no specs for the forseeable future. It's also at least in iex now so if someone modifies it and breaks the test it is more likely they will notice if they are only running the tests for iex.

* `:timeout` - set the timeout for the tests (default 60_000ms)
* `:plural_rules` - See `ExUnit.plural_rule/1` and `ExUnit.plural_rule/2`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this from here since you are not supposed to set it directly anyway.

@michalmuskala
Copy link
Member

I wonder - do we really need the pluralization? The only place we need both singular version and a plural one is for printing: 1 test, 0 failures or 2 tests, 0 failures.
But we can get easily around that if we change the wording: tests: 1, failures: 0 or tests: 2, failures: 0.

I think it's equally readable and avoids the whole pluralization thing. Honestly I see no advantage in having it pluralized, given how complicated it is to maintain the pluralization rules. Instead of a test type as proposed in this PR, we could have test collection what would already be plural.

@josevalim josevalim merged commit c4d6be6 into elixir-lang:master May 16, 2016
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

@ericentin ericentin deleted the antipax-test-noun-customization branch May 16, 2016 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants