Add binding for application:get_application()#95
Open
ctrlaltmilk wants to merge 1 commit intogleam-lang:mainfrom
Open
Add binding for application:get_application()#95ctrlaltmilk wants to merge 1 commit intogleam-lang:mainfrom
application:get_application()#95ctrlaltmilk wants to merge 1 commit intogleam-lang:mainfrom
Conversation
Member
|
Hello! How did you verify this to be working? There's no tests! |
Author
|
I tested it separately - from what I can see, the tests don't run inside an application so the only test would be let assert Error(_) = application.get_application()If you want it, I can add it - not sure if there's any way to spin up an application inside a test so that the success case gets checked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a binding to
get_application/0from the Erlang application module, for use mainly withapplication.priv_directory(). For example, a web server could expose a function to automatically serve static files from the current application's priv directory.I briefly considered binding to
get_application/1, but that would require either separate functions for getting the application from a PID/module name or a new type, and it's much less common to have multiple applications running in Gleam than in Elixir or Erlang.