livebook/test/live_book/evaluator/io_proxy_test.exs
Jonatan Kłosko 79e5c432b3
Move evaluation to a separate Elixir runtime (#20)
* Isolate evaluation in separate node for each session

* Start new remote upon first evaluation and handle nodedown

* Add UI for managing evaluation node, improve naming and structure

* Show runtime initialization errors and some fixes

* Improve standalone node initialization

* Correctly handle multiple sessions connecting to the same node

* Fix session tests concerning evaluation

* Documentation and some refactoring

* Various improvements

* Configure schedulers to get to sleep immediately after evaluation

* Move EvaluatorSpervisor into the Remote namespace

* Fix evaluators cleanup

* Add tests

* Improve flash messages

* Introduce remote genserver taking care of cleanup

* Redefine the Runtime protocol to serve as an interface for evaluation

* Cleanup operations

* Use reference for communication with a standalone node

* Use shortnames for distribution by default

* Update node configuration and make sure epmd is running

* Rename Remote to ErlDist
2021-02-11 12:42:17 +01:00

36 lines
813 B
Elixir

defmodule LiveBook.Evaluator.IOProxyTest do
use ExUnit.Case, async: true
alias LiveBook.Evaluator.IOProxy
setup do
{:ok, io} = IOProxy.start_link()
IOProxy.configure(io, self(), :ref)
%{io: io}
end
# Test the basic ways users interact with :stdio
test "IO.puts", %{io: io} do
IO.puts(io, "hey")
assert_received {:evaluation_stdout, :ref, "hey\n"}
end
test "IO.write", %{io: io} do
IO.write(io, "hey")
assert_received {:evaluation_stdout, :ref, "hey"}
end
test "IO.inspect", %{io: io} do
IO.inspect(io, %{}, [])
assert_received {:evaluation_stdout, :ref, "%{}\n"}
end
test "IO.read", %{io: io} do
assert IO.read(io, :all) == {:error, :enotsup}
end
test "IO.gets", %{io: io} do
assert IO.gets(io, "> ") == {:error, :enotsup}
end
end