`Optional` tests fail periodically
Opened this issue · 1 comments
sunny-g commented
Occasionally, the tests for the Optional
module will fail, though usually a subsequent re-running of the tests will pass. Why?
Ljzn commented
Hello, thank you for making this amazing lib. This problem is caused by module loading order. I fixed it with:
def valid_xdr_type?(atom) when is_atom(atom) do
case Code.ensure_loaded(atom) do
{:module, _} ->
function_exported?(atom, :length, 0) and
(function_exported?(atom, :new, 0) or function_exported?(atom, :new, 1)) and
function_exported?(atom, :valid?, 1) and function_exported?(atom, :encode, 1) and
function_exported?(atom, :decode, 1)
{:error, :nofile} ->
false
end
end