Skip to content

v: utilize new diff functions p1 - #21431

Merged
spytheman merged 2 commits into
vlang:masterfrom
ttytm:v/use-new-diff-fns-1
May 5, 2024
Merged

spytheman merged 2 commits into
vlang:masterfrom
ttytm:v/use-new-diff-fns-1

Conversation

@ttytm

@ttytm ttytm commented May 5, 2024 •

Copy link
Copy Markdown
Member

Regarding the utilization of the new diff functions.

Currently, printing diffs has different approaches in the code base. Below I'm pointing out the two with major differences.

This is because when integrating the new diff functions, things can also be improved and made more consistent. So this PR should allow us to decide on one version that might be more suited then the other. Then it could serve as preferred way when updating the new diff functions in other places. I hope that going about it like this will help to create more clarity and simplify subsequent changes.

  • Approach 1. (visible in the updated vlib/v/compiler_errors_test.v)
    Prints diffs OR expected and found.

  • Approach 2. (visible in the old diff of slow_tests/inout/compiler_test.v)
    Prints first expected then found AND then differences. This is currently used more frequently.

    Atm. the PR updates slow_tests/inout/compiler_test.v from A2 to A1. Resulting in:

    Current Updated
    Screenshot_20240505_134055 Screenshot_20240505_134927

Comment thread vlib/v/compiler_errors_test.v
Comment thread vlib/v/slow_tests/inout/compiler_test.v
@JalonSolov

Copy link
Copy Markdown
Collaborator

Personally, I prefer brevity. If everything expected was found, why waste time/space reporting the 2 lists?

Perhaps it is useful sometimes. For those times, a verbose option would be handy, but I don't like verbosity as the default.

@ttytm

ttytm commented May 5, 2024

Copy link
Copy Markdown
Member Author

@JalonSolov I'm in the same boat. When the expected and found are plainly printed, it's easy to lose track. Especially when they get longer.

Having it less verbose and straight to the point when there is a working diff tool should help to spot what is important more quickly.

@spytheman
spytheman merged commit ee22dcb into vlang:master May 5, 2024
@ttytm
ttytm deleted the v/use-new-diff-fns-1 branch May 5, 2024 13:02
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.

3 participants