The stacktrace line isn't the one you should be running. The test outputs
the file and line to run immediately following the test message. Here's an
example:

  1) test run/1 raises exception when invalid switch is passed
(Mix.Tasks.Conduit.Gen.BrokerTest)
     *test/mix/tasks/conduit.gen.broker_test.exs:17*
     Expected exception OptionParser.Parserror but got
OptionParser.ParseError (1 error found!
     --something-broken : Unknown option)
     code: assert_raise OptionParser.Parserror, fn ->
     stacktrace:
       (elixir) lib/option_parser.ex:231: OptionParser.parse!/2
       (conduit) lib/mix/tasks/conduit.gen.broker.ex:26:
Mix.Tasks.Conduit.Gen.Broker.run/1
       test/mix/tasks/conduit.gen.broker_test.exs:18: (test)


Allen Madsen
http://www.allenmadsen.com


On Wed, Oct 24, 2018 at 4:53 PM OvermindDL1 <[email protected]> wrote:

> Maybe the test should accept a filename and line combination with an
> optional trailing colon instead?
>
> On Wednesday, October 24, 2018 at 2:19:59 PM UTC-6, Denis Gorbachev wrote:
>>
>> Current behavior
>>
>> On error, a stacktrace is displayed:
>>
>>
>>      stacktrace:
>>        (elixir) lib/gen_server.ex:924: GenServer.call/3
>>        test/leverex/loans/loan_server_test.exs:193: (test)
>>
>>
>> Expected behavior
>>
>> Same stacktrace, but without colons (":")
>>
>>
>>      stacktrace:
>>        (elixir) lib/gen_server.ex:924 GenServer.call/3
>>        test/leverex/loans/loan_server_test.exs:193 (test)
>>
>>
>> Rationale
>>
>>
>> When a single test fails, I copy the last line from stacktrace and re-run
>> the test with mix test.watch {filename}. Currently, I have to remove the
>> ":" manually, which is a slight annoyance, but it add up over time.
>>
>> Examples
>>
>> Here are stacktraces of other languages:
>>
>> JavaScript (NodeJS):
>>
>> Error:
>>     at /Users/cfisher/Git/squashed/execProcess.js:6:17
>>     at ChildProcess.exithandler (child_process.js:213:5)
>>     at emitTwo (events.js:106:13)
>>     at ChildProcess.emit (events.js:191:7)
>>     at maybeClose (internal/child_process.js:877:16)
>>     at Socket.<anonymous> (internal/child_process.js:334:11)
>>     at emitOne (events.js:96:13)
>>     at Socket.emit (events.js:188:7)
>>     at Pipe._handle.close [as _onclose] (net.js:498:12)
>>
>>
>> Python:
>>
>>
>> *** print_exception:Traceback (most recent call last):
>>   File "<doctest...>", line 10, in <module>
>>     lumberjack()
>>   File "<doctest...>", line 4, in lumberjack
>>     bright_side_of_death()
>>
>>
>>
>> Go:
>>
>> Recover from panic: Fake error!
>> Stack of 402 bytes: goroutine 1 [running]:
>> main.funcĀ·001()
>>         /Users/mbutcher/Code/Go/src/scratch/stack.go:21 +0xab
>> runtime.panic(0x80b80, 0x2101fb150)
>>         /usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:248 +0x106
>> main.inner()
>>         /Users/mbutcher/Code/Go/src/scratch/stack.go:27 +0x68
>> main.outer()
>>         /Users/mbutcher/Code/Go/src/scratch/stack.go:13 +0x1a
>> main.main()
>>         /Users/mbutcher/Code/Go/src/scratch/stack.go:9 +0x1a
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/64507398-b7ff-4480-a8be-826d46659693%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/64507398-b7ff-4480-a8be-826d46659693%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3CtpoZCNGbNGdmPbtg%3DH%2Bgh%2BKJGn%2BYABeKPuqs%3DdgD50SA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to