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
test files: rename xxx_test.sh to xxx.bats, fix shebang #541
Conversation
This patch includes Glennj's: exercism#25 And also includes expected_results.json fixes, as requested by Glenn on Slack: 3 spaces is fine. Just fix the expected results file to add the missing space. Don’t change anything else.
This patch includes glennj's exercism#25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't get merged until exercism/bash-test-runner#27 is merged
We need to be careful on this. The test runner most support both existing exercises and this new format, and that support must be deployed, before this is merged.
I'm "Requesting Changes" just to block this until the test runner is merged.
@angelikatyborska, @neenjaw, @mpizenberg Any advice on this after doing it on your tracks? (Thank you btw @braoult) |
exercism/bash-test-runner#27 supports both old ( |
tbh I haven't fully taken the time yet to evaluate the implications of the change on the online tooling. The tooling itself in the elm track does not support the old way, only the new one, and the filepaths changes actually occurred a while ago, before starting the work on v3. It's just that I noticed the multiple files issues on the online editor for even older submissions of mine. |
When I discussed about this change on Slack yesterday, I wondered what could be some other side effects, nobody raised the online tooling (and it did not raise an alarm in my mind too, as I never used it :-) Could this be a blocking point ? I don't know at all how all of this interacts... |
The main effect will be that students will get both the bash and the bats files in the editor. The bash ones will be readonly and they'll have to copy their code into the bats ones. |
Well, the online tooling is composed of the tests runner (seems you took care of that), the analyzer (only cares about the solution), the representer (which only cares about the solution, not the tests so fine here) and the online editor, which needs to display the solution (and tests for practice exercises) to the user. So in you case, I think the only point left is to check how is handled the presentation of the tests file in the online editor for practice exercise. |
Yes. @iHiD, why the
|
I'm not following: we're renaming the test file. In the editor, which files are available to edit? My current experience is that only the ".files.solution" file is editable, and the ".files.test" file is shown in the right-hand Tests tab. The existing "bats_extra.bats" file (test helper functions) is nowhere to be seen in the editor. What will students have to copy? |
I actually started maintaining the track after this change happened 🤷 |
My concern here is only : Where and when the online editor gets the list of files (solution and test) to edit ?
|
It is taken from
@iHiD will know this best, but my understanding is that every solution contains the git SHA of the exercise as it were when the student started the exercise and takes files directly from git from that point in time. However, it can change. The platform shows when a change is done to an exercise and shows you the diff between your version and the new version. Then, you can choose to update your solution to the newest version and I think that changes the SHA which means the student will now get the newest versions of all files, including the new |
* Reflect bats changes (exercism/bash#541) * style
OK, a couple of things.
I've now merged the test-runner one so remove my lock on this. |
Yes: If both files are there, test-runner will use by default the new one (
As the test code itself is unchanged, we are fine here. |
The workflow is doing this: gh api repos/exercism/bash/pulls/541/files --paginate --jq '
.[] |
select(.status == "added" or .status == "modified" or .status == "renamed") |
select(.filename |
match("\\.(sh|bash|bats)$")) |
.filename
' And this finds all the renamed test scripts, and the tests all run successfully. |
@IsaacG I know you have opinions about this subject. Can you review please? |
Do you mean the extension itself, as seen on Slack (no extension for executable) ? |
No, removing the extension will make the pr.yml github workflow harder to make specific. I am hoping that Isaac can give a review faster than Jeremy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Thank you for your work.
@@ -32,4 +32,4 @@ trap cleanup EXIT | |||
cp "${solution}" "${exercise_name}.sh" | |||
|
|||
# Run the tests | |||
bats "${exercise_name}_test.sh" | |||
bats "${exercise_name}.bats" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note/no change requested. In theory, with the fixed shebang. we should be able to give the tests a +x
and just run them ... but in practice calling bats
with the filename is probably easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exact. I thought about it, but unsure about this +x
on non *ix-like systems... And as I saw solutions (.sh
) were non executable, I preferred to change nothing. Someone more aware of this should do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't think that exercism download respects the executable bits.
* Reflect bats changes (exercism/bash#541) * style
tests scripts: change extension to .bats, fix shebang.
Reviewer Resources:
Track Policies