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

simplify the update of test files #69

Open
ThomasBreuer opened this issue Apr 16, 2024 · 3 comments
Open

simplify the update of test files #69

ThomasBreuer opened this issue Apr 16, 2024 · 3 comments

Comments

@ThomasBreuer
Copy link
Contributor

As far as I understand, the test files for the package get updated via the instructions in tst/generate_tst_files.g.
These instructions themselves would have to be updated, but I think it would be better to use AutoDoc's extract_examples := true option (which is available in the AutoDoc version that is required by makedoc.g) instead.

@fingolfin
Copy link
Member

Yeah this is very complex, see also the content of the examples dir.

I guess part of it was a desire to also be able to update the examples in the XML files. Do we have capabilities for that? In any case, in my experience this is not so common so I'd not be worried about loosing it.

I thought about cleaning this up at some point but gave up because there were so many levels of indirection :-/.

@jdebeule
Copy link
Collaborator

The generate_tst_files.g is now obsolete. I have been working on a new version, which is almost ready. When generating examples for the documentation, I noticed that it becomes very tedious to update the examples when output changes due to changes in the package. Also some examples are not suitable as test, and vice versa. So I wanted a system that start from a set of files only containing GAP commands (.g files), convert them into either .tst files or files that can be includes using <#Include ...

There is now a file generate_example_files_new in /pkg/forms/examples and a similar file in /pkg/forms/tst.

Instead of calling GAP from within a GAP session and generating output using input/output streams, we now generate a shell script. The script will call a number of GAPs, one by one, with the correct input file and which writes output to the correct output file. Afterwards, we convert the output files into .xml files.

This seems to work much better now.

@ThomasBreuer
Copy link
Contributor Author

If the new setup simplifies updates then this is in principle fine.
However, I do not catch the point:
In particular, the situation "when output changes due to changes in the package" is in my eyes something that should be rather exceptional, and in such a case I would think whether it might be better to change the code in order to get the old output.

If one wants to update example output automatically (and then compare the result with the old contents and decide how to deal with the differences), there are already the following tools.

  • In order to generate testfiles that contain the actual output of the tests, one can use the rewriteToFile component of the optional record for Test and TestDirectory.
  • In order to update the contents of examples in GAPDoc manuals, one can use the changeSources component in the optional record for RunExamples.

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

No branches or pull requests

3 participants