Repository navigation
style: reformat exercise sources with the V 0.5.2 formatter - #324
Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
| fn test_verse__single_verse__first_generic_verse() { | ||
| expected := | ||
| ("Ten green bottles hanging on the wall, | ||
| ("Ten green bottles hanging on the wall, |
There was a problem hiding this comment.
Curious, what does v version output for you?
I just did a quick test by pulling your changes down and running v fmt -w on this file. I was expecting to see no diff, but I got this diff at this location:
@@ -1,8 +1,7 @@
module main
fn test_verse__single_verse__first_generic_verse() {
- expected :=
- ("Ten green bottles hanging on the wall,
+ expected := ("Ten green bottles hanging on the wall,
Ten green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be nine green bottles hanging on the wall.")There were similar diff through the file. I wasn't sure if this was coming down to the the V version. For reference, mine outputs:
V 0.5.2 7647ce1
There was a problem hiding this comment.
PS C:\Users\MR> v version
V 0.5.2 3a4d9d3
v is evolving very fast and some time update minutely. so the output if you keep up with master is never the same.
There was a problem hiding this comment.
it turn out that:
7647ce1— the0.5.2tag, 2026-07-133a4d9d3—masterHEAD, 2026-10-02
so the same version but different commit.
andfmtoutput change time to time, so the only way of keep it repeatable is pin the commit.
|
Please use and run |
Regenerate the vfmt pass against commit 7647ce1 (tag: 0.5.2), as requested in review, and rebase it on current main. The previous pass was produced by a master build; the version string alone did not distinguish the two, since v.mod still reads 0.5.2 on master. Rebasing onto main dropped most of the old diff: the example solutions that the earlier revision touched are already clean under this build, which also fixed them for V 0.5.2. Seven files remain: bottle-song, dominoes, intergalactic-transmission line joining and removal of a blank line at the start of an empty body knapsack, palindrome-products, saddle-points, word-search alignment of consecutive struct field values No semantic changes: no & or mut dropped, no argument count change, no comma moved inside a multiline literal. Verified with v built from 7647ce1: - v fmt is idempotent on the result - bin/test passes on all 114 practice exercises - the 7 touched exercises pass in exercism/vlang-test-runner, which also reports V 0.5.2 7647ce1 - configlet lint passes
237247d to
fa742f0
Compare
|
built from commit |
|
I will leave this review for kahgoh. The next work item will be one of the new practice exercises: save-the-cow. |
What
The
v fmtpass, on its own. It is the last piece of #307 that is not a new exercise, so it can be reviewed and merged without any of them.v fmtin V 0.5.2 does five things to the exercise sources:ifexpression that is returned30 files across 27 exercises.
grade-school.vandrobot-name.vare left alone: the<TYPE>placeholders in them cannot be parsed by the formatter.Why this is safe to merge
None of it changes what the code does. V treats
'...'and...the same way, and none of the rewritten strings contains a quote or an escape, so the two forms are equivalent here. The rest is indentation, a comma and a pair of parentheses.Verified for every exercise this touches:
bin/verify-exercises-in-docker(the currentvlang-test-runnerimage, V 0.4.8): passvlang/setup-vinstalls forbin/testin CI: passconfiglet lintpasses;v fmt -landv vetare clean on all 30 filesFor the merge commit
Please add:
The test outcomes of these exercises are identical before and after, so there is no reason to re-run the existing student solutions.