summaryrefslogtreecommitdiff
path: root/lib/elixir
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@dashbit.co>2022-07-27 16:02:43 +0200
committerJosé Valim <jose.valim@dashbit.co>2022-07-27 16:02:53 +0200
commit8271fc5f0eb37316c3abad1d8aa8a9319eb2c720 (patch)
tree35ad47bf93163d4e6996fdaa502b60d73412bcee /lib/elixir
parent14a1ee4c29061a10b2337a14ec7126b2afe4f5c3 (diff)
downloadelixir-8271fc5f0eb37316c3abad1d8aa8a9319eb2c720.tar.gz
Remove more conditional tests
Diffstat (limited to 'lib/elixir')
-rw-r--r--lib/elixir/test/elixir/exception_test.exs48
-rw-r--r--lib/elixir/test/elixir/kernel/raise_test.exs24
-rw-r--r--lib/elixir/test/elixir/task/supervisor_test.exs32
-rw-r--r--lib/elixir/test/elixir/task_test.exs26
4 files changed, 61 insertions, 69 deletions
diff --git a/lib/elixir/test/elixir/exception_test.exs b/lib/elixir/test/elixir/exception_test.exs
index e3dfa5969..6c0676349 100644
--- a/lib/elixir/test/elixir/exception_test.exs
+++ b/lib/elixir/test/elixir/exception_test.exs
@@ -875,36 +875,34 @@ defmodule ExceptionTest do
end
end
- if System.otp_release() >= "24" do
- describe "error_info" do
- test "badarg on erlang" do
- assert message(:erlang, & &1.element("foo", "bar")) == """
- errors were found at the given arguments:
-
- * 1st argument: not an integer
- * 2nd argument: not a tuple
- """
- end
+ describe "error_info" do
+ test "badarg on erlang" do
+ assert message(:erlang, & &1.element("foo", "bar")) == """
+ errors were found at the given arguments:
- test "badarg on ets" do
- ets = :ets.new(:foo, [])
- :ets.delete(ets)
+ * 1st argument: not an integer
+ * 2nd argument: not a tuple
+ """
+ end
- assert message(:ets, & &1.insert(ets, 1)) == """
- errors were found at the given arguments:
+ test "badarg on ets" do
+ ets = :ets.new(:foo, [])
+ :ets.delete(ets)
- * 1st argument: the table identifier does not refer to an existing ETS table
- * 2nd argument: not a tuple
- """
- end
+ assert message(:ets, & &1.insert(ets, 1)) == """
+ errors were found at the given arguments:
- test "system_limit on counters" do
- assert message(:counters, & &1.new(123_456_789_123_456_789_123_456_789, [])) == """
- a system limit has been reached due to errors at the given arguments:
+ * 1st argument: the table identifier does not refer to an existing ETS table
+ * 2nd argument: not a tuple
+ """
+ end
- * 1st argument: counters array size reached a system limit
- """
- end
+ test "system_limit on counters" do
+ assert message(:counters, & &1.new(123_456_789_123_456_789_123_456_789, [])) == """
+ a system limit has been reached due to errors at the given arguments:
+
+ * 1st argument: counters array size reached a system limit
+ """
end
end
diff --git a/lib/elixir/test/elixir/kernel/raise_test.exs b/lib/elixir/test/elixir/kernel/raise_test.exs
index b4265c639..5fd61167a 100644
--- a/lib/elixir/test/elixir/kernel/raise_test.exs
+++ b/lib/elixir/test/elixir/kernel/raise_test.exs
@@ -71,21 +71,19 @@ defmodule Kernel.RaiseTest do
end
end
- if System.otp_release() >= "24" do
- test "raise with error_info" do
- {exception, stacktrace} =
- try do
- raise "a"
- rescue
- e -> {e, __STACKTRACE__}
- end
+ test "raise with error_info" do
+ {exception, stacktrace} =
+ try do
+ raise "a"
+ rescue
+ e -> {e, __STACKTRACE__}
+ end
- assert [{__MODULE__, _, _, meta} | _] = stacktrace
- assert meta[:error_info] == %{module: Exception}
+ assert [{__MODULE__, _, _, meta} | _] = stacktrace
+ assert meta[:error_info] == %{module: Exception}
- assert Exception.format_error(exception, stacktrace) ==
- %{general: "a", reason: "#Elixir.RuntimeError"}
- end
+ assert Exception.format_error(exception, stacktrace) ==
+ %{general: "a", reason: "#Elixir.RuntimeError"}
end
test "reraise message" do
diff --git a/lib/elixir/test/elixir/task/supervisor_test.exs b/lib/elixir/test/elixir/task/supervisor_test.exs
index aa4e004e5..090c9908f 100644
--- a/lib/elixir/test/elixir/task/supervisor_test.exs
+++ b/lib/elixir/test/elixir/task/supervisor_test.exs
@@ -319,23 +319,21 @@ defmodule Task.SupervisorTest do
end
describe "await/1" do
- if System.otp_release() >= "24" do
- test "demonitors and unalias on timeout", config do
- task =
- Task.Supervisor.async(config[:supervisor], fn ->
- assert_receive :go
- :done
- end)
-
- assert catch_exit(Task.await(task, 0)) == {:timeout, {Task, :await, [task, 0]}}
- new_ref = Process.monitor(task.pid)
- old_ref = task.ref
-
- send(task.pid, :go)
- assert_receive {:DOWN, ^new_ref, _, _, _}
- refute_received {^old_ref, :done}
- refute_received {:DOWN, ^old_ref, _, _, _}
- end
+ test "demonitors and unalias on timeout", config do
+ task =
+ Task.Supervisor.async(config[:supervisor], fn ->
+ assert_receive :go
+ :done
+ end)
+
+ assert catch_exit(Task.await(task, 0)) == {:timeout, {Task, :await, [task, 0]}}
+ new_ref = Process.monitor(task.pid)
+ old_ref = task.ref
+
+ send(task.pid, :go)
+ assert_receive {:DOWN, ^new_ref, _, _, _}
+ refute_received {^old_ref, :done}
+ refute_received {:DOWN, ^old_ref, _, _, _}
end
test "exits on task throw", config do
diff --git a/lib/elixir/test/elixir/task_test.exs b/lib/elixir/test/elixir/task_test.exs
index e0335bc6d..5c35f4a29 100644
--- a/lib/elixir/test/elixir/task_test.exs
+++ b/lib/elixir/test/elixir/task_test.exs
@@ -256,22 +256,20 @@ defmodule TaskTest do
end
describe "await/2" do
- if System.otp_release() >= "24" do
- test "demonitors and unalias on timeout" do
- task =
- Task.async(fn ->
- assert_receive :go
- :done
- end)
+ test "demonitors and unalias on timeout" do
+ task =
+ Task.async(fn ->
+ assert_receive :go
+ :done
+ end)
- assert catch_exit(Task.await(task, 0)) == {:timeout, {Task, :await, [task, 0]}}
- send(task.pid, :go)
- ref = task.ref
+ assert catch_exit(Task.await(task, 0)) == {:timeout, {Task, :await, [task, 0]}}
+ send(task.pid, :go)
+ ref = task.ref
- wait_until_down(task)
- refute_received {^ref, :done}
- refute_received {:DOWN, ^ref, _, _, _}
- end
+ wait_until_down(task)
+ refute_received {^ref, :done}
+ refute_received {:DOWN, ^ref, _, _, _}
end
test "exits on timeout" do