0

我知道IEx.pry当你运行像iex -S mix.

我正在做一些不使用混合的长生不老药练习。我使用elixir myfile.exs.

如何使用 IEx 运行此文件,以便可以IEx.pry在应用程序中使用断点?

编辑:这里是文件:

# hello_world.exs
defmodule HelloWorld do
  @doc """
  Greets the user by name, or by saying "Hello, World!"
  if no name is given.
  """
  @spec hello(String.t) :: String.t
  def hello(name \\ "World") do
    "Hello, #{name}!"
  end
end

# hello_world_test.exs
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("hello_world.exs", __DIR__)
end

ExUnit.start
ExUnit.configure exclude: :pending, trace: true

defmodule HelloWorldTest do
  use ExUnit.Case

  test "says hello with no name" do
    assert HelloWorld.hello() == "Hello, World!"
  end
end

输出:

➜  hello-world elixir hello_world_test.exs
Excluding tags: [:pending]


HelloWorldTest
  * test says hello with no name (0.00ms)


Finished in 0.03 seconds (0.03s on load, 0.00s on tests)
1 test, 0 failures

Randomized with seed 530992

➜  hello-world iex hello_world_test.exs
Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.4.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
4

0 回答 0