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

Make accept_snapshot() work on filenames containing a dot (#1669) #2029

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

Conversation

mcol
Copy link
Contributor

@mcol mcol commented Nov 17, 2024

This changes slightly the logic for matching file names:

  • before if a file name was considered to be without extension, we would add the .md and then compare it with the actual file names in the _snaps directory. However, that would fail if the file contained dots, as they would be considered to be a file extension: for them no .md was added to their name, and therefore they would never match with the actual files in the _snaps directory, so no update could ever succeed

  • with this patch, we strip any .md or .txt extension from the file names that snapshot_manage() receives, and compare those with the actual file names from the _snaps directory also without extension

I've added tests and a NEWS item (all tests pass locally).

Fixes #1669.

This changes slightly the logic for matching file names:

- before if a file name was considered to be without extension, we would
add the `.md` and then compare it with the actual file names in the
`_snaps` directory. However, that would fail if the file contained dots,
as they would be considered to be a file extension: for them no `.md` was
added to their name, and therefore they would never match with the actual
files in the `_snaps` directory, so no update could ever succeed

- with this patch, we strip any `.md` or `.txt` extension from the file
names received by `snapshot_manage()`, and compare those with the actual
file names from the `_snaps` directory also without extension
@mcol
Copy link
Contributor Author

mcol commented Nov 17, 2024

The test failures seem unrelated: I also get them locally on the main branch when using devtools::test(), but not on main or on the PR branches when using R CMD check.

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.

Wrong snapshot_accept() suggestion if period in test file name
1 participant