Let a project type name its tests' extension - #2142
Merged
Merged
Conversation
Both directions of the implementation/test toggle took the extension from the file they started with, so an Elixir module in lib/foo.ex offered to create test/foo_test.ex - which mix will not run, ExUnit tests being scripts. :src-extension and :test-extension say otherwise when a type needs to, and default to the old behaviour when it doesn't. The bundled elixir type sets them, so the toggle round-trips lib/foo.ex against test/foo_test.exs.
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.
Both directions of the implementation/test toggle took the extension from the
file they started with. So in a mix project, toggling from
lib/foo.exofferedto create
test/foo_test.ex- whichmix testwill not run, ExUnit tests beingscripts.
:test-suffixonly reaches the part of the name before the extension,as the reporter found.
:src-extensionand:test-extensionlet a type say otherwise, and default tothe old behaviour when it doesn't - so nothing changes for the languages where a
test carries its implementation's extension, which is most of them. Both
directions are covered, since going back from
foo_test.exsneeds to know theimplementation is
.ex.The bundled
elixirtype sets them, so the toggle round-tripslib/foo.ex<->test/foo_test.exs. They register and update like every othertype attribute,
nilclearing them as usual - there's a spec for that, and forthe prefix form as well as the suffix one.
Fixes #1686