Skip to content

feat: add assert_creates_file/3 macro to Igniter.Test #291

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lawik
Copy link
Contributor

@lawik lawik commented May 29, 2025

Add a new testing macro that allows users to assert that a file was created and test its contents using a function. This provides a more flexible API for testing file creation compared to the existing assert_creates/3 macro.

The new macro supports:

  • Pipeline-style testing with |> assert_creates_file(path, fn file -> ... end)
  • Custom assertions on file content using pattern matching and regex
  • Proper error handling and stack trace preservation

Contributor checklist

  • Bug fixes include regression tests
  • Features include unit/acceptance tests

Add a new testing macro that allows users to assert that a file was
created and test its contents using a function. This provides a more
flexible API for testing file creation compared to the existing
assert_creates/3 macro.

The new macro supports:
- Pipeline-style testing with |> assert_creates_file(path, fn file -> ... end)
- Custom assertions on file content using pattern matching and regex
- Proper error handling and stack trace preservation
end)

"""
defmacro assert_creates_file(igniter, path, fun) do
Copy link
Contributor

Choose a reason for hiding this comment

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

should modify existing assert_creates

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