Skip to content

Add test for overwriting file in Run function #34

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

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

catatsuy
Copy link
Owner

@catatsuy catatsuy commented Apr 6, 2024

This pull request includes changes to the CLI and its tests in the internal/cli package, as well as an update to a test data file. The most significant changes include a minor adjustment to the order of defer statements in the Run method, the addition of a new test case TestRun_successForOverwrite, and an update to the test_for_overwrite.txt test data file.

Here are the most important changes, grouped by theme:

Order adjustment in CLI:

  • internal/cli/cli.go: The order of defer statements in the Run method was changed. The os.Remove call is now placed before the tmpFile.Close call. This change ensures that the temporary file is removed even if closing the file fails.

Addition of new test case:

  • internal/cli/cli_test.go: A new test case TestRun_successForOverwrite was added. This test case includes several subtests that verify the behavior of the -overwrite, -replace, and -filter options. A helper function copyFile was also added to assist with test setup.

Update to test data file:

@catatsuy catatsuy merged commit 4c88fa5 into main Apr 6, 2024
@catatsuy catatsuy deleted the feature_mod_overwrite branch April 6, 2024 07:11
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.

1 participant