Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional tests fail periodically #17

Open
sunny-g opened this issue Aug 20, 2018 · 1 comment
Open

Optional tests fail periodically #17

sunny-g opened this issue Aug 20, 2018 · 1 comment

Comments

@sunny-g
Copy link
Owner

sunny-g commented Aug 20, 2018

Occasionally, the tests for the Optional module will fail, though usually a subsequent re-running of the tests will pass. Why?

@Ljzn
Copy link

Ljzn commented Mar 10, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants