Merge branch 'elixir-1.18' into 'develop'

Elixir 1.18 warnings

See merge request pleroma/pleroma!4358
This commit is contained in:
vaartis 2025-06-05 09:00:39 +00:00
commit 8484e09424
27 changed files with 83 additions and 156 deletions

View file

@ -1 +0,0 @@
21.1

View file

@ -1 +0,0 @@
22.1

View file

@ -1 +0,0 @@
22.4

View file

@ -1 +0,0 @@
23.0

View file

@ -1,42 +0,0 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.OTPVersionTest do
use ExUnit.Case, async: true
alias Pleroma.OTPVersion
describe "check/1" do
test "22.4" do
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/22.4"]) ==
"22.4"
end
test "22.1" do
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/22.1"]) ==
"22.1"
end
test "21.1" do
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/21.1"]) ==
"21.1"
end
test "23.0" do
assert OTPVersion.get_version_from_files(["test/fixtures/warnings/otp_version/23.0"]) ==
"23.0"
end
test "with nonexistent file" do
assert OTPVersion.get_version_from_files([
"test/fixtures/warnings/otp_version/non-exising",
"test/fixtures/warnings/otp_version/22.4"
]) == "22.4"
end
test "empty paths" do
assert OTPVersion.get_version_from_files([]) == nil
end
end
end

View file

@ -2669,8 +2669,12 @@ defmodule Pleroma.UserTest do
assert {:ok, user} = User.update_last_active_at(user)
assert user.last_active_at >= test_started_at
assert user.last_active_at <= NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
assert NaiveDateTime.compare(user.last_active_at, test_started_at) in [:gt, :eq]
assert NaiveDateTime.compare(
user.last_active_at,
NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
) in [:lt, :eq]
last_active_at =
NaiveDateTime.utc_now()
@ -2682,10 +2686,15 @@ defmodule Pleroma.UserTest do
|> cast(%{last_active_at: last_active_at}, [:last_active_at])
|> User.update_and_set_cache()
assert user.last_active_at == last_active_at
assert NaiveDateTime.compare(user.last_active_at, last_active_at) == :eq
assert {:ok, user} = User.update_last_active_at(user)
assert user.last_active_at >= test_started_at
assert user.last_active_at <= NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
assert NaiveDateTime.compare(user.last_active_at, test_started_at) in [:gt, :eq]
assert NaiveDateTime.compare(
user.last_active_at,
NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
) in [:lt, :eq]
end
test "active_user_count/1" do

View file

@ -21,8 +21,12 @@ defmodule Pleroma.Web.Plugs.UserTrackingPlugTest do
|> assign(:user, user)
|> UserTrackingPlug.call(%{})
assert user.last_active_at >= test_started_at
assert user.last_active_at <= NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
assert NaiveDateTime.compare(user.last_active_at, test_started_at) in [:gt, :eq]
assert NaiveDateTime.compare(
user.last_active_at,
NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
) in [:lt, :eq]
end
test "doesn't update last_active_at if it was updated recently", %{conn: conn} do
@ -38,7 +42,7 @@ defmodule Pleroma.Web.Plugs.UserTrackingPlugTest do
|> assign(:user, user)
|> UserTrackingPlug.call(%{})
assert user.last_active_at == last_active_at
assert NaiveDateTime.compare(user.last_active_at, last_active_at) == :eq
end
test "skips updating last_active_at if user ID is nil", %{conn: conn} do

View file

@ -2,8 +2,6 @@
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
Code.put_compiler_option(:warnings_as_errors, true)
ExUnit.configure(capture_log: true, max_cases: System.schedulers_online())
ExUnit.start(exclude: [:federated])