mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-14 18:05:35 +08:00
Fix ignored output (#1323)
This commit is contained in:
parent
4206e84682
commit
920f70817e
2 changed files with 24 additions and 2 deletions
|
@ -653,10 +653,10 @@ defmodule Livebook.Notebook do
|
|||
defp add_output([], {idx, {:stdout, text}}),
|
||||
do: [{idx, {:stdout, normalize_stdout(text)}}]
|
||||
|
||||
defp add_output([], output), do: [output]
|
||||
|
||||
defp add_output(outputs, {_idx, :ignored}), do: outputs
|
||||
|
||||
defp add_output([], output), do: [output]
|
||||
|
||||
# Session clients prune stdout content and handle subsequent
|
||||
# ones by directly appending page content to the previous one
|
||||
defp add_output([{_idx1, {:stdout, :__pruned__}} | _] = outputs, {_idx2, {:stdout, _text}}) do
|
||||
|
|
|
@ -402,6 +402,28 @@ defmodule Livebook.NotebookTest do
|
|||
{:frame, [{:text, "hola"}], %{ref: "1", type: :replace}}
|
||||
)
|
||||
end
|
||||
|
||||
test "skips ignored output" do
|
||||
notebook = %{
|
||||
Notebook.new()
|
||||
| sections: [
|
||||
%{
|
||||
Section.new()
|
||||
| id: "s1",
|
||||
cells: [%{Cell.new(:code) | id: "c1", outputs: []}]
|
||||
}
|
||||
],
|
||||
output_counter: 1
|
||||
}
|
||||
|
||||
assert %{
|
||||
sections: [
|
||||
%{
|
||||
cells: [%{outputs: []}]
|
||||
}
|
||||
]
|
||||
} = Notebook.add_cell_output(notebook, "c1", :ignored)
|
||||
end
|
||||
end
|
||||
|
||||
describe "find_frame_outputs/2" do
|
||||
|
|
Loading…
Reference in a new issue