summaryrefslogtreecommitdiff
path: root/lib/iex/test/iex/evaluator_test.exs
blob: 0860956e441f0891bd6d4ce2030fca60007fea1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Code.require_file "../test_helper.exs", __DIR__

defmodule IEx.EvaluatorTest do
  use ExUnit.Case, async: true

  alias IEx.Evaluator, as: E

  test "format_stacktrace returns formatted result in columns" do
    frames = [
      {List,   :one,    1, [file: "loc",    line: 1]},
      {String, :second, 2, [file: "loc2",   line: 102]},
      {IEx,    :three,  3, [file: "longer", line: 1234]},
      {List,   :four,   4, [file: "loc",    line: 1]},
    ]

    expected = """
        (elixir) loc:1: List.one/1
        (elixir) loc2:102: String.second/2
           (iex) longer:1234: IEx.three/3
        (elixir) loc:1: List.four/4
    """

    assert E.format_stacktrace(frames) <> "\n" == expected
  end
end