Я знаю, что вы можете получить точку останова, используя 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)>
iex myfile.exs
? - person Dogbert   schedule 14.04.2017iex
; вам нужно добавить пару строк: stackoverflow.com/questions/40805663/ - person Dogbert   schedule 17.04.2017