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

Add a "fix all tests and manuals" file #2897

Open
ChrisJefferson opened this issue Oct 5, 2018 · 0 comments
Open

Add a "fix all tests and manuals" file #2897

ChrisJefferson opened this issue Oct 5, 2018 · 0 comments
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: tests issues or PRs related to tests

Comments

@ChrisJefferson
Copy link
Contributor

ChrisJefferson commented Oct 5, 2018

I think it would be nice to have a single script (or makefile target) which would correct all tests and manual examples when a change is made (obviously users would still have to read the diff to make sure the changes make sense!). This would be (I think) a good PR for someone to work on who is newish to GAP. I'm happy go give more advice if anyone wants to work on this.

Specifically: Have a script in (say tst) called fixtestsandmanuals.sh which in-place replaces the results of all tests in both the tst directory, and in the manuals through the library, with the output GAP currently produces. This is based on the rewriteToFile option of Test and TestDirectory (if you haven't used rewriteToFile, I'd start by playing with that first).

General design idea:

  1. The TestDirectory command has a rewriteToFile option, which re-writes the output of tests. It's easy to run this over testinstall and the other test directories, but it would be nice if there was a quick one-use command to do it. Also we can't just run TestDirectory over tst, as we need to run each test directory in a separate GAP session.

2A) If you look at how testmanuals is done in ci.sh, we use TestManualChapter, in testmanuals.g. We could pass rewriteToFile to rewrite the manual examples into the files. For example, here is a snippet:

####  Reference manual, Chapter 3  ####
gap> START_TEST("ref-chapter003.tst");

#LOC# [ "/home/caj/files/reps/gap/gap/doc/ref/../../lib/userpref.g", 88, 94 ]
gap> SetUserPreference( "Pager", "less" );
...

Note that #LOC#, it shows you were this test came from, so you know where to put back a 'fixed' version.

2B) Once we've rewriten the manual examples, we need to get them back into the manuals. However, the manual test files have a well-formatted layout where we give the file, start-line and end-line of the extracted example, so it (should?) be easy to take the file, chop out the old test and pop in the new one. If you start this, make sure you do one file in a single pass, as remember when you add or remove lines you'll change the position of other, later lines in the same file.

@olexandr-konovalov olexandr-konovalov added the topic: tests issues or PRs related to tests label Oct 5, 2018
@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: tests issues or PRs related to tests
Projects
None yet
Development

No branches or pull requests

3 participants