Skip to content

test: amplify and optimize doctool/test-make-doc

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Currently, the doctool/test-make-doc.js has 2 tiny performance nits and 2 logic oversights.

Performance nits

  1. The list of doc files is filtered too late, after some usage with unneeded files burden.
  2. The list of links in TOC is not filtered at all, while 48 links from 98 ones are duplicate.

Logic oversights.

  1. JSON docs generation is not tested, while it is possible that JSON generation is aborted after all the HTML files are created.
  2. Makefile generates docs by getting the console.log() output from the tools/doc/generate.js and redirecting it to the doc files. If tools/doc/generate.js throws, an empty doc file is still created. So we can have a situation when the last .md source has an error and all the needed files are nevertheless present, just one of them is empty. So we need to check if all the files are not empty.

Refactoring strategy

  1. Filter out unneeded files as soon as possible.
  2. Filter out duplicate links.
  3. Include JSON files in generation tests.
  4. Check that all the actual files are not empty.

The test is changed considerably, but it may be more strict, full and performant in this form.

Merge request reports

Loading