Update to Elixir 1.16.0 and OTP 26.2.1 (#2416)

This commit is contained in:
Wojtek Mach 2023-12-29 14:16:20 +01:00 committed by GitHub
parent 4f38fea5cd
commit 6f4eb7f58b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 59 deletions

View file

@ -180,8 +180,8 @@ defmodule Livebook.Runtime.Dependencies do
iex> Livebook.Runtime.Dependencies.parse_term(~s|{:jason, "~> 1.3.0"}|)
{:ok, {:jason, "~> 1.3.0"}}
iex> Livebook.Runtime.Dependencies.parse_term(~s|{:jason, "~> 1.3.0", runtime: false, meta: 'data'}|)
{:ok, {:jason, "~> 1.3.0", runtime: false, meta: 'data'}}
iex> Livebook.Runtime.Dependencies.parse_term(~s|{:jason, "~> 1.3.0", runtime: false, meta: "data"}|)
{:ok, {:jason, "~> 1.3.0", runtime: false, meta: "data"}}
iex> Livebook.Runtime.Dependencies.parse_term(~s|%{name: "Jake", numbers: [1, 2, 3.4]}|)
{:ok, %{name: "Jake", numbers: [1, 2, 3.4]}}

View file

@ -5,7 +5,7 @@ end
defmodule Livebook.MixProject do
use Mix.Project
@elixir_requirement "~> 1.15.2 or ~> 1.16-dev"
@elixir_requirement "~> 1.16"
@version "0.13.0-dev"
@description "Automate code & data workflows with interactive notebooks"

View file

@ -229,7 +229,7 @@ defmodule Livebook.IntellisenseTest do
label: "RuntimeError",
kind: :struct,
detail: "exception",
documentation: "No documentation available",
documentation: "An exception for a generic runtime error.",
insert_text: "RuntimeError"
}
] = Intellisense.get_completion_items("RuntimeE", context, node())
@ -504,34 +504,32 @@ defmodule Livebook.IntellisenseTest do
assert [
%{
label: "join/1",
label: "utc_today/0",
kind: :function,
detail: ~S{Enum.join(enumerable, joiner \\ "")},
detail: "Date.utc_today(calendar \\\\ Calendar.ISO)",
documentation: """
Joins the given `enumerable` into a string using `joiner` as a
separator.
Returns the current date in UTC.
```
@spec join(t(), String.t()) :: String.t()
@spec utc_today(Calendar.calendar()) :: t()
```\
""",
insert_text: "join($0)"
insert_text: "utc_today()"
},
%{
label: "join/2",
label: "utc_today/1",
kind: :function,
detail: ~S{Enum.join(enumerable, joiner \\ "")},
detail: "Date.utc_today(calendar \\\\ Calendar.ISO)",
documentation: """
Joins the given `enumerable` into a string using `joiner` as a
separator.
Returns the current date in UTC.
```
@spec join(t(), String.t()) :: String.t()
@spec utc_today(Calendar.calendar()) :: t()
```\
""",
insert_text: "join($0)"
insert_text: "utc_today($0)"
}
] = Intellisense.get_completion_items("Enum.jo", context, node())
] = Intellisense.get_completion_items("Date.utc", context, node())
end
test "function completion using a variable bound to a module" do

View file

@ -1365,7 +1365,7 @@ defmodule Livebook.LiveMarkdown.ExportTest do
hub_secret_names: ["DB_PASSWORD"]
}
expected_document = ~R"""
expected_document = ~r"""
# My Notebook
## Section 1

View file

@ -1,6 +1,8 @@
defmodule Livebook.Runtime.DependenciesTest do
use ExUnit.Case, async: true
import Livebook.TestHelpers
alias Livebook.Runtime.Dependencies
doctest Dependencies
@ -197,20 +199,25 @@ defmodule Livebook.Runtime.DependenciesTest do
end
test "returns an error if the code has a syntax error" do
assert Dependencies.add_mix_deps(
{:error, message} =
Dependencies.add_mix_deps(
"""
# Comment
[,1]
""",
[@jason]
)
assert clean_message(message) ==
"""
** (SyntaxError) invalid syntax found on nofile:2:2:
error: syntax error before: ','
2 [,1]
^
nofile:2:2\
"""
# Comment
[,1]
""",
[@jason]
) ==
{:error,
"""
** (SyntaxError) nofile:2:2: syntax error before: ','
|
2 | [,1]
| ^\
"""}
end
test "adds config if specified" do

View file

@ -34,7 +34,7 @@ defmodule Livebook.Runtime.Evaluator.IOProxyTest do
end
test "IO.read", %{io: io} do
assert IO.read(io, :all) == {:error, :enotsup}
assert IO.read(io, :eof) == {:error, :enotsup}
end
test "IO.gets", %{io: io} do

View file

@ -1,6 +1,8 @@
defmodule Livebook.Runtime.EvaluatorTest do
use ExUnit.Case, async: true
import Livebook.TestHelpers
alias Livebook.Runtime.Evaluator
setup ctx do
@ -39,12 +41,6 @@ defmodule Livebook.Runtime.EvaluatorTest do
defmacrop ansi_number(number), do: "\e[34m#{number}\e[0m"
defmacrop ansi_string(string), do: "\e[32m\"#{string}\"\e[0m"
defmacrop terminal_text(text, chunk \\ false) do
quote do
%{type: :terminal_text, text: unquote(text), chunk: unquote(chunk)}
end
end
defmacrop error(message) do
quote do
%{type: :error, message: unquote(message), context: nil}
@ -223,10 +219,13 @@ defmodule Livebook.Runtime.EvaluatorTest do
}}
assert clean_message(message) === """
** (TokenMissingError) file.ex:1:2: syntax error: expression is incomplete
|
1 | 1+
| ^\
** (TokenMissingError) token missing on file.ex:1:2:
error: syntax error: expression is incomplete
1 1+
^
file.ex:1:2\
"""
end
@ -1374,18 +1373,4 @@ defmodule Livebook.Runtime.EvaluatorTest do
end
"""
end
defp clean_message(message) do
message
|> remove_trailing_whitespace()
|> remove_ansi()
end
defp remove_trailing_whitespace(string) do
String.replace(string, ~r/ +$/m, "")
end
defp remove_ansi(string) do
String.replace(string, ~r/\e\[\d+m/, "")
end
end

View file

@ -119,4 +119,18 @@ defmodule Livebook.TestHelpers do
%{type: :terminal_text, text: unquote(text), chunk: unquote(chunk)}
end
end
def clean_message(message) do
message
|> remove_trailing_whitespace()
|> remove_ansi()
end
defp remove_trailing_whitespace(string) do
String.replace(string, ~r/ +$/m, "")
end
defp remove_ansi(string) do
String.replace(string, ~r/\e\[\d+m/, "")
end
end

View file

@ -1,6 +1,6 @@
elixir="1.15.7"
otp="26.1.2"
elixir="1.16.0"
otp="26.2.1"
openssl="1.1.1s"
rebar3="3.22.0"
debian="bookworm-20231009-slim"
ubuntu="focal-20230126"
ubuntu="focal-20231003"