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

List of maps bug #116

Merged
merged 2 commits into from
Aug 23, 2023
Merged

List of maps bug #116

merged 2 commits into from
Aug 23, 2023

Conversation

kgullion-vonage
Copy link
Contributor

@kgullion-vonage kgullion-vonage commented Aug 23, 2023

First commit adds test to demonstrate missing functionality, second commit is my best guess at an implementation.

output of failing test:

  1) test NimbleOptions.docs/1 autogenerated type docs (NimbleOptions.DocsTest)
     test/nimble_options/docs_test.exs:293
     ** (FunctionClauseError) no function clause matching in NimbleOptions.Docs.get_raw_type_str/1

     The following arguments were given to NimbleOptions.Docs.get_raw_type_str/1:
     
         # 1
         {:map, []}
     
     Attempted function clauses (showing 10 out of 27):
     
         defp get_raw_type_str(nil)
         defp get_raw_type_str({:custom, _mod, _fun, _args})
         defp get_raw_type_str(:mfa)
         defp get_raw_type_str(:mod_arg)
         defp get_raw_type_str({:or, _values})
         defp get_raw_type_str({:in, _})
         defp get_raw_type_str({:fun, arity})
         defp get_raw_type_str(:any)
         defp get_raw_type_str(:reference)
         defp get_raw_type_str(:pid)
         ...
         (17 clauses not shown)
     
     code: assert NimbleOptions.docs(schema) == """
     stacktrace:
       (nimble_options 1.0.2) lib/nimble_options/docs.ex:113: NimbleOptions.Docs.get_raw_type_str/1
       (nimble_options 1.0.2) lib/nimble_options/docs.ex:139: NimbleOptions.Docs.get_raw_type_str/1
       (nimble_options 1.0.2) lib/nimble_options/docs.ex:104: NimbleOptions.Docs.get_type_str/1
       (nimble_options 1.0.2) lib/nimble_options/docs.ex:43: NimbleOptions.Docs.option_doc/2
       (elixir 1.15.2) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
       (nimble_options 1.0.2) lib/nimble_options/docs.ex:6: NimbleOptions.Docs.generate/2
       test/nimble_options/docs_test.exs:313: (test)

............................................................................................................................
Finished in 0.2 seconds (0.2s async, 0.00s sync)
3 doctests, 123 tests, 1 failure

@josevalim josevalim merged commit 46e70d7 into dashbitco:main Aug 23, 2023
2 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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

Successfully merging this pull request may close these issues.

2 participants