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

Add tests for shebang mixins #15267

Closed
wants to merge 1 commit into from
Closed

Conversation

dduugg
Copy link
Sponsor Member

@dduugg dduugg commented Apr 19, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Adds test for a pair of mixins, which previously broke when being refactored due to a lack of test coverage for the instance case of module_function. (See prior comment)

These are my first tests that make use of files and formulae, so please apply an appropriate amount of scrutiny (I didn't find examples that directly imitated what I was attempting to test).

cc @Bo98 @MikeMcQuaid

@@ -5,19 +5,12 @@
require "utils/shebang"

describe Language::Perl::Shebang do
let(:file) { Tempfile.new("perl-shebang") }
let(:file) { File.open("#{TEST_TMPDIR}/perl-shebang", "w") }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let(:file) { File.open("#{TEST_TMPDIR}/perl-shebang", "w") }
let(:file) { Pathname.new("perl-shebang") }

as this was technically a Pathname not File. Similarly, I think TEST_TMPDIR may be implicit.

Generally it's considered 👎🏻 to use File.open without the block form.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have mktmpdir which creates a directory that is automatically cleaned after a test.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label May 13, 2023
@github-actions github-actions bot closed this May 20, 2023
@github-actions github-actions bot added the outdated PR was locked due to age label Jun 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age stale No recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants