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

Use literal file names in test_commands #1212

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

Conversation

dnicolodi
Copy link
Contributor

There is no need for the strings to be real file paths. Using string literals makes the test obvious to follow. This continues the work aimed at removing the binary test artifacts from the repository.

Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

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

I agree this is clearer but it is also more error prone and going to be easier to introduce behavior that would be understanding if the tests were a real end user attack vector

@dnicolodi dnicolodi force-pushed the simplify-test_command branch from 41f44cc to cdebaeb Compare January 11, 2025 10:15
There is no need for the strings to be real file paths and using
string manipulation to build the file names is error prone. Define
simple helpers that construct the file names as needed. This makes the
tests intent and implementation easier to understand.
@dnicolodi dnicolodi force-pushed the simplify-test_command branch from cdebaeb to 2f8f562 Compare January 11, 2025 10:17
@dnicolodi
Copy link
Contributor Author

I agree this is clearer but it is also more error prone and going to be easier to introduce behavior that would be understanding if the tests were a real end user attack vector

I think something is wrong in this sentence: I cannot really parse it.

However, I agree that the tests as constructed are error prone, but I don't think there is a significant difference in how error prone is to construct the file names with string concatenation or using string literals. I now reworked this significantly to use helpers to construct the file names. Please have another look.

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