Current section
Files
Jump to
Current section
Files
lib/fast_ci/versionless.ex
defmodule FastCi.Versionless do
@moduledoc """
Module associated with functions which should work with multiple version of elixir. This is a
centralized location where `apply/3` is called for multiple versions of ExUnit and such.
"""
@doc """
Get the `time` variable. This is generally called moments before tests are ran.
"""
def ensure_ex_unit_modules_loaded() do
cond do
Kernel.function_exported?(ExUnit.Server, :modules_loaded, 1) ->
apply(ExUnit.Server, :modules_loaded, [false])
Kernel.function_exported?(ExUnit.Server, :modules_loaded, 0) ->
apply(ExUnit.Server, :modules_loaded, [])
end
end
@doc """
Enqueue the module into the ExUnit.Server for execution
"""
def enqueue_module({module, type}) do
cond do
Kernel.function_exported?(ExUnit.Server, :add_module, 2) ->
apply(ExUnit.Server, :add_module, [module, {type == "async", false}])
Kernel.function_exported?(ExUnit.Server, :add_sync_module, 1) and type == "sync" ->
apply(ExUnit.Server, :add_sync_module, [module])
Kernel.function_exported?(ExUnit.Server, :add_async_module, 1) and type == "async" ->
apply(ExUnit.Server, :add_async_module, [module])
end
end
end