-
-
Notifications
You must be signed in to change notification settings - Fork 528
Add templates for exercises batch 3 #1773
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
base: main
Are you sure you want to change the base?
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 |
* Enhance underscore method to filter invalid characters and update test file naming convention * Add test case which test underscore for special characters * Use character classes in regex. Also expose description for nested test cases. * Underscore must not create multiple underscores around special characters
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.
Non-blocking suggestion.
generatorv2/lib/utils.rb
Outdated
@@ -47,7 +47,7 @@ def additional_json(json) | |||
def remove_tests(uuid, json) | |||
json["cases"].each_with_object([]) do |x, acc| | |||
if x["cases"] |
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.
if x["cases"] | |
acc << if x["cases"] |
This, along with ...
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 seems to create error when I do it that way
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.
Can you show the patch, how you attempted this?
generatorv2/lib/utils.rb
Outdated
acc << { "cases" => remove_tests(uuid, x), "description" => x["description"] } | ||
elsif uuid.include?(x["uuid"]) | ||
acc << x |
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.
... with this...
acc << { "cases" => remove_tests(uuid, x), "description" => x["description"] } | |
elsif uuid.include?(x["uuid"]) | |
acc << x | |
{ "cases" => remove_tests(uuid, x), "description" => x["description"] } | |
elsif uuid.include?(x["uuid"]) | |
x |
... removes the unconditional work from the conditional branches.
I did not touch the double quotes, though. Unsure if that is already attended to in another place, if we are doing that.
def test_largest_possible_diamond | ||
skip | ||
answer = Diamond.make_diamond('Z') | ||
string = " A \n"\ |
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.
Consider using HereDoc for this, rather than consecutive string "trick".
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.
Same for the others.
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.
Trailing whitespace.
class CircularBufferTest < Minitest::Test | ||
<% json["cases"].each do |cases| %> | ||
def test_<%= underscore(cases["description"]) %> | ||
<%= skip? %> |
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.
<%= skip? %> | |
<%= skip? %> |
class DartsTest < Minitest::Test | ||
<% json["cases"].each do |cases| %> | ||
def test_<%= underscore(cases["description"]) %> | ||
<%= skip? %> |
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.
<%= skip? %> | |
<%= skip? %> |
<% json["cases"].each do |cases| %> | ||
<% cases["cases"].each do |sub_case| %> | ||
def test_<%= underscore(sub_case["description"]) %> | ||
<%= skip? %> |
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.
<%= skip? %> | |
<%= skip? %> |
Includes: