exercism / ocaml

Exercism exercises in OCaml.
https://exercism.org/tracks/ocaml
MIT License
94 stars 50 forks source link

Add version tracking to exercises #284

Closed sshine closed 1 year ago

sshine commented 6 years ago

According to #283, add (version x.y.z) to the dune-project file for each exercises, and according to this comment below, add x.y.z to .meta/version (update 1), where x.y.z corresponds to test data versioning in problem-specifications.

This gets us towards an automated overview faster.

Update 1: Since #361 adds version tracking to so many exercises, the working list is changed to contain only missing exercises. Since we have later decided to also include a .meta/version file for each exercise, that item is also added to this ticket.


The approach I am thinking of following is:

  1. If it's obvious what version of the test suite an exercise uses, commit (version x.y.z) without updating the test.
  2. If it's not obvious what version of the test suite an exercise uses, it might be easier to add missing tests from problem-specifications so the test matches the latest version, and commit (version x.y.z).
  3. If it's not obvious that we're even testing the same things, mark the exercise as WONTFIX in this issue and continue. (I've seen that the Standard ML track has some exercises that test things that are incompatible with the same exercises for Haskell and OCaml, and I don't know if the OCaml track has the same warts.)
sshine commented 6 years ago

@stevejb71: I'm thinking of doing maybe a letter a day.

Let me know if you think the format of the commit messages is right.

marionebl commented 5 years ago

Might an automated solution be the most appropriate here? E.g. we could extend the test_generator to support multiple template files including other meta data files:

$ tree tools/test-generator/templates/ocaml/acronym/tools/test-generator/templates/ocaml/acronym/
|-- dune.tpl
|-- dune-project.tpl
`-- test.ml.tpl

Content of dune-project.tpl

(lang dune 1.1)
(version $version)
marionebl commented 5 years ago

Hey @sshine, do you have thoughts on my suggestion?

sshine commented 5 years ago

@marionebl: I think that is a very appropriate idea, now that the test generator has had such a makeover by you.

I have recently been participating in bootstrapping the Tcl track, and in deciding where to place the canonical test version number, I've learned that many tracks put this in .meta/version. There is a project-wide discussion of this in exercism/discussions#239 which hasn't converged yet, but .meta/version appears to be a good bet.

In the Tcl track we went with having the version both in the test file itself for the student to see and in .meta/version for possible future bookkeeping purposes. I made some CI scripts that checked that the two numbers were not out of sync, which is less of a problem having a test generator.

My suggested placement in dune-project was inspired by the Haskell track's placement in package.yaml, since it simulates package versioning: Even though someone's instance of the problem isn't something you'd want to publish, I felt that it simulated releasing a real package. Also, it being meta information and Ocaml having actual packaging files for containing these, it beats having the version in the test file itself.

TL;DR: Would you like me to contribute anything to the test generator?

marionebl commented 5 years ago

Very good we consent on this. Thanks for bringing up the relevant discussion, helps a lot with putting some context on this.

Skimming over exercism/discussion#239 I'd suggest we emit the version in the following files

In the future we might want to emit more files, e.g. exercise.opam etc. For this reason I'd suggest we extend the test-generator's templating mechanism to read all files found in templates/<exercise-name>/ and emit the results to exercises/<exercise-name>/. What do you think?

I am eager to try my OCaml skills on this one, maybe you could sort out the problem around PRs not being mergeable due to permission problems?

sshine commented 5 years ago

I'm happy that you want to do this.

Do you mean some of the PRs that are currently queued up?

marionebl commented 5 years ago

I meant #356 which appears to have been fixed now :)