Skip to content
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

Make sure our existing generators are up-to-date #604

Closed
petertseng opened this issue Apr 1, 2017 · 3 comments
Closed

Make sure our existing generators are up-to-date #604

petertseng opened this issue Apr 1, 2017 · 3 comments

Comments

@petertseng
Copy link
Member

petertseng commented Apr 1, 2017

In x-common, we have various exercises with canonical-data.json representing the recommended set of tests for that exercise. We created generators to more easily keep up with changes in x-common. Whenever x-common changes, the task is as simple as re-running the generator.

The current documentation is at https://github.com/exercism/xgo#generating-test-cases - if at any point we find that we should explain something better, we should add any necessary documentation.

Preliminaries:

  • I find the list of our generators using ls exercises/*/cases_test.go | cut -d/ -f2 from the root of the xgo directory.
  • I find the list of exercises with canonical-data.json using ls exercises/*/canonical-data.json | cut -d/ -f2 from the root of the x-common directory.

This issue concerns exercises that already have a generator.

Because of recent changes to make all the canonical-data.json files conform to a common scheme (exercism/problem-specifications#625), it might be the case that our current generator no longer runs.

For these exercises we'd make sure the current generator runs, or if it doesn't then we'd update it.

In addition, the three lines at the top of the file:

// Source: {{.Ori}}
{{if .Commit}}// Commit: {{.Commit}}
{{end}}

can simply be replaced with {{.Header}}, which has the effect of:

  • Deprecating the Ori field, which is confusingly named
  • Showing the x-common version in the test file
  • Reducing duplicate code

Relevant exercises

Once all these are complete, we can delete the deprecated Ori field.

@leenipper
Copy link
Contributor

recent changes to make all the canonical-data.json files

The forth exercise generator became askew due to that. It runs, but test cases are empty. I have a WIP for it.

@robphoenix robphoenix removed the pinned Shown at the top of the issue page label Apr 6, 2017
leenipper added a commit to leenipper/xgo that referenced this issue Apr 7, 2017
For issue exercism#604.

- Update generator:
  Use .Header in template.
  Align template with latest canonical-data.json.

- Update test program:
  Reference testGroups containing the generated test cases.
  Annotate the FAIL output with test group name & test case description.
  Add PASS output for successful cases.
leenipper added a commit to leenipper/xgo that referenced this issue Apr 8, 2017
For issue exercism#604.

- Update generator:
  Use .Header in template.
  Align template with latest canonical-data.json.

- Update test program:
  Reference testGroups containing the generated test cases.
  Annotate the FAIL output with test group name & test case description.
  Add PASS output for successful cases.
leenipper added a commit to leenipper/xgo that referenced this issue Apr 8, 2017
For issue exercism#604.

Use .Header in generator template.
Change Valid => Cases to align template with latest canonical-data.json.
leenipper added a commit to leenipper/xgo that referenced this issue Apr 8, 2017
For issue exercism#604.

- Update generator:
  Use .Header in generator template.
  Align template with latest canonical-data.json.
  Add test description to generated cases.

- Update test program:
  Output test description.
  Add PASS output for successful cases.
leenipper added a commit to leenipper/xgo that referenced this issue Apr 11, 2017
For issue exercism#604.

- Update generator:
  Use .Header in generator template.
  Align template with latest canonical-data.json.
leenipper added a commit to leenipper/xgo that referenced this issue Apr 13, 2017
For issue exercism#604.

Use .Header in generator template.
Align template with latest canonical-data.json.
Add test description to generated cases.
leenipper added a commit to leenipper/xgo that referenced this issue Apr 18, 2017
For issue exercism#604.

Use .Header in generator template.
Align template with latest canonical-data.json.
Use a OneCase struct type to contain the whole
set of possible json objects for the various
test groups.
Add istrSlice as conversion helper for .Expected.
@robphoenix
Copy link
Contributor

I've changed this issue from a checklist to multiple issues. I've left the links to relevant PR's in the original comment but I don't think it's necessary to continue adding these.

Let me know if any of this is wrong/not as good as it could be! BTW Hub was really useful for this. I was able to repeat the command git issue create -l "good first patch","#604 confirm generators are up-to-date" and it would open my editor with the same message so I just needed to change the exercise in the title. Still a little repetitive, maybe if my bash skills were better... 😄

@petertseng
Copy link
Member Author

Great work, everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants