julismz

julismz

Set name to DocTest tests

Hi,

I’m wondering if there is some way to put some custom / detailed name to the tests using the DocTest, in order to be showed on the console when I run “mix test --trace”.

I mixed 2 DocTests and 1 ExUnit to show the diff on the output:

$ mix test --trace

FooTest [test/foo_test.exs]

  • doctest Foo.say_hello/0 (2) (0.00ms) [L#3]
  • test return default greeting (0.00ms) [L#5]
  • doctest Foo.analyse/0 (1) (0.00ms) [L#3]

Finished in 0.03 seconds (0.00s async, 0.03s sync)
2 doctests, 1 test, 0 failures

Randomized with seed 321499

I’ve red the documentation but couldn’t find anything.

Thanks!

Most Liked

BartOtten

BartOtten

I’ve read the source code. The answer is: No can’t do.

# a = arity
# f = function
# m = module
# n = accumulating number
defp test_name(%{fun_arity: :moduledoc}, m, n) do
    "module #{inspect(m)} (#{n})"
  end

  defp test_name(%{fun_arity: {f, a}}, m, n) do
    "#{inspect(m)}.#{f}/#{a} (#{n})"
  end

source

Last Post!

julismz

julismz

Thanks Bart, looks like a good opportunity for PR? mhhh…

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement