-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Exercise generator #52
Conversation
@bmulvihill , I'll look at this after work but I'm glad you reopened it! Looks cool! I would love to add pulling the raw json from x-common's github so we don't have to worry about having x-common locally or it being up to date (I have a branch out that does that so I can extend this after we merge this). This is awesome!!
I don't think this style of test case is absolutely necessary and the benefit of automated test cases is greater than the burden of not-perfectly-canonical-test-cases. One thing that I would love to push towards is a unified generator for all exercises but... maybe there's too much variation between them. |
Thanks for taking a look! I agree about the x-common problem, I just went with what we were doing on the Ruby repo for now since it is a simple solution. I also agree a unified generator would be nice, but until the day where all the canonical data adheres to a the same signature/interface creating a simple TestCase class to handle the differences should work. |
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.
I don't really have much to say about all this 😆 it looks pretty great!
) | ||
|
||
def workload | ||
if !name |
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.
I usually like to use unless
of if !
. Just a nit...
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.
I agree, but I have a rebuttal in the case when an else statement is used, I think unless can be confusing, but I could change this to if name
and switch the logic around.
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.
Ah, yeah. True... I do usually use unless
by itself.
Thanks for the update though!
So this is awesome. I think if you're happy with it I'll merge it in and get to working on pulling in the json from github and then knocking out some more exercises. Thanks a bunch again! |
Overview
Based on #20
Creates an basic exercise generator for the Crystal language track. The generator lives in the
src
directory. This generator is based on the ruby generator - but is not a complete copy. (Beware I am a Ruby dev, and have been getting into Crystal lately, so I have not completely learned all the Crystal best practices). I have created a sample generator for the hello-world exercise as an example.Creating a new Generator
src/generator/exercises
and create a new generator file (i.e. hello_world.cr).Running the Generator
From within the xcrystal directory:
crystal src/generator/generate.cr hello-world
Or build a binary
Future Work/Issues
This is just an initial implementation and would like to keep this PR fairly focused on just getting a basic generator implemented.
Currently a lot of the test suites write the tested method is a describe block (i.e.
describe "#hello"
). I am not quite sure a clean way to implement this using the canonical data since it doesn't define the tested methods.Let me know if you have any questions/concerns/comments!