Skip to content

exercise util: fix detection of test updates #685

Closed as not planned
Closed as not planned
@coriolinus

Description

@coriolinus

Test update detection should operate according to these rules

  • if the generated name for a particular test is test_description_from_the_canonical_data, and there already exists a test named test_description_from_the_canonical_data, then check if the text of the test is equal to the newly generated test text:
    • if the text of the test is equal to the generated test text, then nothing has changed, so we leave the old test in place and do not write the new test
    • if the text of the test is not equal to the generated test text, then something has changed. We can't expect an automatic tool to know which to keep, so we should keep the existing test, change the name by appending a suffix, and insert the generated test. The format I expect is test_description_from_the_canonical_data_N, where N is the lowest integer > 1 which does not generate a name collision
  • if the generated name for a particular test is test_description_from_the_canonical_data, and there already exists a test named description_in_other_words, an automatic tool can't be expected to notice that the test exists already, so simply retain the existing test and also insert the generated test. The tool user or the PR reviewer are the ones who should catch those cases.
  • given the rules above, we need neither //NEW nor //UPDATED. Therefore, those comments should no longer be emitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions